1251881Speter/*
2251881Speter * url.c:  converting paths to urls
3251881Speter *
4251881Speter * ====================================================================
5251881Speter *    Licensed to the Apache Software Foundation (ASF) under one
6251881Speter *    or more contributor license agreements.  See the NOTICE file
7251881Speter *    distributed with this work for additional information
8251881Speter *    regarding copyright ownership.  The ASF licenses this file
9251881Speter *    to you under the Apache License, Version 2.0 (the
10251881Speter *    "License"); you may not use this file except in compliance
11251881Speter *    with the License.  You may obtain a copy of the License at
12251881Speter *
13251881Speter *      http://www.apache.org/licenses/LICENSE-2.0
14251881Speter *
15251881Speter *    Unless required by applicable law or agreed to in writing,
16251881Speter *    software distributed under the License is distributed on an
17251881Speter *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18251881Speter *    KIND, either express or implied.  See the License for the
19251881Speter *    specific language governing permissions and limitations
20251881Speter *    under the License.
21251881Speter * ====================================================================
22251881Speter */
23251881Speter
24251881Speter
25251881Speter
26251881Speter#include <apr_pools.h>
27251881Speter
28251881Speter#include "svn_pools.h"
29251881Speter#include "svn_error.h"
30251881Speter#include "svn_types.h"
31251881Speter#include "svn_opt.h"
32251881Speter#include "svn_wc.h"
33251881Speter#include "svn_client.h"
34251881Speter#include "svn_dirent_uri.h"
35251881Speter#include "svn_path.h"
36251881Speter
37251881Speter#include "private/svn_wc_private.h"
38251881Speter#include "client.h"
39251881Speter#include "svn_private_config.h"
40251881Speter
41251881Speter
42251881Speter
43251881Spetersvn_error_t *
44251881Spetersvn_client_url_from_path2(const char **url,
45251881Speter                          const char *path_or_url,
46251881Speter                          svn_client_ctx_t *ctx,
47251881Speter                          apr_pool_t *result_pool,
48251881Speter                          apr_pool_t *scratch_pool)
49251881Speter{
50251881Speter  if (!svn_path_is_url(path_or_url))
51251881Speter    {
52251881Speter      SVN_ERR(svn_dirent_get_absolute(&path_or_url, path_or_url,
53251881Speter                                      scratch_pool));
54251881Speter
55251881Speter      return svn_error_trace(
56251881Speter                 svn_wc__node_get_url(url, ctx->wc_ctx, path_or_url,
57251881Speter                                      result_pool, scratch_pool));
58251881Speter    }
59251881Speter  else
60251881Speter    *url = svn_uri_canonicalize(path_or_url, result_pool);
61251881Speter
62251881Speter  return SVN_NO_ERROR;
63251881Speter}
64