]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/subversion/subversion/libsvn_client/url.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / subversion / subversion / libsvn_client / url.c
1 /*
2  * url.c:  converting paths to urls
3  *
4  * ====================================================================
5  *    Licensed to the Apache Software Foundation (ASF) under one
6  *    or more contributor license agreements.  See the NOTICE file
7  *    distributed with this work for additional information
8  *    regarding copyright ownership.  The ASF licenses this file
9  *    to you under the Apache License, Version 2.0 (the
10  *    "License"); you may not use this file except in compliance
11  *    with the License.  You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  *    Unless required by applicable law or agreed to in writing,
16  *    software distributed under the License is distributed on an
17  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18  *    KIND, either express or implied.  See the License for the
19  *    specific language governing permissions and limitations
20  *    under the License.
21  * ====================================================================
22  */
23
24
25 \f
26 #include <apr_pools.h>
27
28 #include "svn_pools.h"
29 #include "svn_error.h"
30 #include "svn_types.h"
31 #include "svn_opt.h"
32 #include "svn_wc.h"
33 #include "svn_client.h"
34 #include "svn_dirent_uri.h"
35 #include "svn_path.h"
36
37 #include "private/svn_wc_private.h"
38 #include "client.h"
39 #include "svn_private_config.h"
40
41 \f
42
43 svn_error_t *
44 svn_client_url_from_path2(const char **url,
45                           const char *path_or_url,
46                           svn_client_ctx_t *ctx,
47                           apr_pool_t *result_pool,
48                           apr_pool_t *scratch_pool)
49 {
50   if (!svn_path_is_url(path_or_url))
51     {
52       SVN_ERR(svn_dirent_get_absolute(&path_or_url, path_or_url,
53                                       scratch_pool));
54
55       return svn_error_trace(
56                  svn_wc__node_get_url(url, ctx->wc_ctx, path_or_url,
57                                       result_pool, scratch_pool));
58     }
59   else
60     *url = svn_uri_canonicalize(path_or_url, result_pool);
61
62   return SVN_NO_ERROR;
63 }