Mercurial > hgsubversion
annotate hgsubversion/svnrepo.py @ 597:737292a31028
svnrepo: ease debugging of Subversion fallback
Show a verbose note when falling back to Subversion support, and
enable showing the traceback.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Wed, 31 Mar 2010 22:06:05 +0200 |
parents | 037bba1c6736 |
children | b70f7c82b9b8 |
rev | line source |
---|---|
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
1 """ |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
2 repository class-based interface for hgsubversion |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
3 |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
4 Copyright (C) 2009, Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
5 See parent package for licensing. |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
6 |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
7 Internally, Mercurial assumes that every single repository is a localrepository |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
8 subclass: pull() is called on the instance pull *to*, but not the one pulled |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
9 *from*. To work around this, we create two classes: |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
10 |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
11 - svnremoterepo for Subversion repositories, but it doesn't really do anything. |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
12 - svnlocalrepo for local repositories which handles both operations on itself -- |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
13 the local, hgsubversion-enabled clone -- and the remote repository. Decorators |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
14 are used to distinguish and filter these operations from others. |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
15 """ |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
16 |
342
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
17 from mercurial import error |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
18 from mercurial import util as hgutil |
342
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
19 from mercurial import httprepo |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
20 import mercurial.repo |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
diff
changeset
|
21 |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
22 import util |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
23 import wrappers |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
24 import svnwrap |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
25 import svnmeta |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
26 |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
27 propertycache = hgutil.propertycache |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
diff
changeset
|
28 |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
29 def generate_repo_class(ui, repo): |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
30 """ This function generates the local repository wrapper. """ |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
31 |
347
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
32 superclass = repo.__class__ |
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
33 |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
34 def remotesvn(fn): |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
35 """ |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
36 Filter for instance methods which require the first argument |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
37 to be a remote Subversion repository instance. |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
38 """ |
347
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
39 original = getattr(repo, fn.__name__) |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
40 def wrapper(self, *args, **opts): |
342
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
41 capable = getattr(args[0], 'capable', lambda x: False) |
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
42 if capable('subversion'): |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
43 return fn(self, *args, **opts) |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
44 else: |
347
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
45 return original(*args, **opts) |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
46 wrapper.__name__ = fn.__name__ + '_wrapper' |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
47 wrapper.__doc__ = fn.__doc__ |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
48 return wrapper |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
diff
changeset
|
49 |
347
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
50 class svnlocalrepo(superclass): |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
51 @remotesvn |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
52 def push(self, remote, force=False, revs=None): |
347
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
53 return wrappers.push(self, remote, force, revs) |
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
54 |
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
55 @remotesvn |
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
56 def pull(self, remote, heads=[], force=False): |
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
57 return wrappers.pull(self, remote, heads, force) |
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
58 |
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
59 @remotesvn |
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
60 def findoutgoing(self, remote, base=None, heads=None, force=False): |
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
345
diff
changeset
|
61 return wrappers.outgoing(repo, remote, heads, force) |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
62 |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
63 def svnmeta(self, uuid=None, subdir=''): |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
64 return svnmeta.SVNMeta(self, uuid, subdir) |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
65 |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
66 repo.__class__ = svnlocalrepo |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
67 |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
68 class svnremoterepo(mercurial.repo.repository): |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
69 """ the dumb wrapper for actual Subversion repositories """ |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
70 |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
71 def __init__(self, ui, path=None): |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
72 self.ui = ui |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
73 if path is None: |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
74 path = self.ui.config('paths', 'default') |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
75 self.path = path |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
76 self.capabilities = set(['lookup', 'subversion']) |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
77 |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
78 @propertycache |
468
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
464
diff
changeset
|
79 def svnauth(self): |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
80 # DO NOT default the user to hg's getuser(). If you provide |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
81 # *any* default username to Subversion, it won't use any remembered |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
82 # username for the desired realm, breaking OS X Keychain support, |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
83 # GNOME keyring support, and all similar tools. |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
84 user = self.ui.config('hgsubversion', 'username') |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
85 passwd = self.ui.config('hgsubversion', 'password') |
468
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
464
diff
changeset
|
86 url = util.normalize_url(self.path) |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
464
diff
changeset
|
87 user, passwd, url = svnwrap.parse_url(url, user, passwd) |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
464
diff
changeset
|
88 return url, user, passwd |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
464
diff
changeset
|
89 |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
464
diff
changeset
|
90 @property |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
464
diff
changeset
|
91 def svnurl(self): |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
464
diff
changeset
|
92 return self.svnauth[0] |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
464
diff
changeset
|
93 |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
464
diff
changeset
|
94 @propertycache |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
464
diff
changeset
|
95 def svn(self): |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
464
diff
changeset
|
96 return svnwrap.SubversionRepo(*self.svnauth) |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
97 |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
98 @property |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
99 def svnuuid(self): |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
100 return self.svn.uuid |
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
443
diff
changeset
|
101 |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
102 def url(self): |
345
49a656155a92
remove pointless rstrip('/')
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
344
diff
changeset
|
103 return self.path |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
104 |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
105 def lookup(self, key): |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
106 return key |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
107 |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
108 def cancopy(self): |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
109 return False |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
110 |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
111 def heads(self, *args, **opts): |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
112 """ |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
113 Whenever this function is hit, we abort. The traceback is useful for |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
114 figuring out where to intercept the functionality. |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
115 """ |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
116 raise hgutil.Abort('command unavailable for Subversion repositories') |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
117 |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
118 def instance(ui, url, create): |
342
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
119 if url.startswith('http://') or url.startswith('https://'): |
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
120 try: |
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
121 # may yield a bogus 'real URL...' message |
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
122 return httprepo.instance(ui, url, create) |
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
123 except error.RepoError: |
597
737292a31028
svnrepo: ease debugging of Subversion fallback
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
468
diff
changeset
|
124 ui.traceback() |
737292a31028
svnrepo: ease debugging of Subversion fallback
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
468
diff
changeset
|
125 ui.note('(falling back to Subversion support)\n') |
342
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
126 |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
127 if create: |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
128 raise hgutil.Abort('cannot create new remote Subversion repository') |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
158
diff
changeset
|
129 |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
328
diff
changeset
|
130 return svnremoterepo(ui, url) |