~svn/ubuntu/raring/subversion/ppa

« back to all changes in this revision

Viewing changes to subversion/libsvn_client/url.c

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:26:14 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205012614-qom4xfypgtsqc2xq
Tags: 1.2.3dfsg1-3ubuntu1
Merge with the final Debian release of 1.2.3dfsg1-3, bringing in
fixes to the clean target, better documentation of the libdb4.3
upgrade and build fixes to work with swig1.3_1.3.27.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * url.c:  converting paths to urls
 
3
 *
 
4
 * ====================================================================
 
5
 * Copyright (c) 2000-2004 CollabNet.  All rights reserved.
 
6
 *
 
7
 * This software is licensed as described in the file COPYING, which
 
8
 * you should have received as part of this distribution.  The terms
 
9
 * are also available at http://subversion.tigris.org/license-1.html.
 
10
 * If newer versions of this license are posted there, you may use a
 
11
 * newer version instead, at your option.
 
12
 *
 
13
 * This software consists of voluntary contributions made by many
 
14
 * individuals.  For exact contribution history, see the revision
 
15
 * history and logs, available at http://subversion.tigris.org/.
 
16
 * ====================================================================
 
17
 */
 
18
 
 
19
 
 
20
 
 
21
#include <apr_pools.h>
 
22
 
 
23
#include "svn_error.h"
 
24
#include "svn_wc.h"
 
25
#include "svn_client.h"
 
26
#include "svn_path.h"
 
27
#include "client.h"
 
28
 
 
29
 
 
30
 
 
31
 
 
32
svn_error_t *
 
33
svn_client_url_from_path (const char **url,
 
34
                          const char *path_or_url,
 
35
                          apr_pool_t *pool)
 
36
{
 
37
  svn_wc_adm_access_t *adm_access;          
 
38
  const svn_wc_entry_t *entry;  
 
39
  svn_boolean_t is_url = svn_path_is_url (path_or_url);
 
40
  
 
41
  if (is_url)
 
42
    {
 
43
      *url = path_or_url;
 
44
    }
 
45
  else
 
46
    {
 
47
      SVN_ERR (svn_wc_adm_probe_open3 (&adm_access, NULL, path_or_url,
 
48
                                       FALSE, 0, NULL, NULL, pool));
 
49
      SVN_ERR (svn_wc_entry (&entry, path_or_url, adm_access, FALSE, pool));
 
50
      SVN_ERR (svn_wc_adm_close (adm_access));
 
51
      
 
52
      *url = entry ? entry->url : NULL;
 
53
    }
 
54
 
 
55
  return SVN_NO_ERROR;
 
56
}