Mercurial > hgsubversion
annotate __init__.py @ 331:75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
The 'hg svn url' command has been killed; the replacement is
'.hg/hgrc'. More stuff related to its disappearance has been stripped,
including two tests.
HgChangeReceiver now takes a UUID argument, which it uses to ensure
that remote repositories remain unchanged. This is a temporary
solution, and I'm not entirely satisfied with how it's done either.
Access to the UUID file has been isolated in a HgChangeReceiver
property.
Some more tests have been updated to use ui.pushbuffer()/popbuffer(),
and to pass through the Mercurial API.
Moved the arguments to wrappers.pull() to the UI configuration.
Also, remove HgChangeReceiver.opts in favour of a 'usebranchnames'
instance & configuration variable. The name is taken from the
ConvertExtension.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Fri, 15 May 2009 19:18:43 +0200 |
parents | 235022089da6 |
children | 56d877e6ccbb |
rev | line source |
---|---|
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
1 '''integration with Subversion repositories |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
2 |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
3 This extension allows Mercurial to act as a Subversion client, for |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
4 fast incremental, bidirectional updates. |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
5 |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
6 It is *not* ready yet for production use. You should only be using |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
7 this if you're ready to hack on it, and go diving into the internals |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
8 of Mercurial and/or Subversion. |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
9 |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
10 Before using hgsubversion, it is *strongly* encouraged to run the |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
11 automated tests. See `README' in the hgsubversion directory for |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
12 details. |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
13 ''' |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
14 # TODO: The docstring should be slightly more helpful, and at least mention all |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
15 # configuration settings we support |
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
16 |
52
fb1d911bb0be
svnclone now updates to the tip revision if it is the initial clone.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
17 import os |
251
23b02f892d9b
Fix up imports in __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
248
diff
changeset
|
18 import sys |
23b02f892d9b
Fix up imports in __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
248
diff
changeset
|
19 import traceback |
52
fb1d911bb0be
svnclone now updates to the tip revision if it is the initial clone.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
20 |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
21 from mercurial import commands |
256
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
22 from mercurial import extensions |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
304
diff
changeset
|
23 from mercurial import hg |
248
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
24 from mercurial import util as hgutil |
209
d06572495c5e
Better error message when we encounter an unknown SSL cert.
Augie Fackler <durin42@gmail.com>
parents:
199
diff
changeset
|
25 |
d06572495c5e
Better error message when we encounter an unknown SSL cert.
Augie Fackler <durin42@gmail.com>
parents:
199
diff
changeset
|
26 from svn import core |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
27 |
241
4950b18cf949
Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
234
diff
changeset
|
28 import svncommands |
328
48ec2d62dc29
Rename tag_repo.py to svnrepo.py and get rid of the 'fake' tags.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
326
diff
changeset
|
29 import svnrepo |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
115
diff
changeset
|
30 import util |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
256
diff
changeset
|
31 import wrappers |
291
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
273
diff
changeset
|
32 import svnexternals |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
115
diff
changeset
|
33 |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
34 schemes = ('svn', 'svn+ssh', 'svn+http', 'svn+file') |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
35 |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
36 optionmap = { |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
37 'tagpaths': ('hgsubversion', 'tagpaths'), |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
38 'authors': ('hgsubversion', 'authormap'), |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
39 'filemap': ('hgsubversion', 'filemap'), |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
40 'stupid': ('hgsubversion', 'stupid'), |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
41 'defaulthost': ('hgsubversion', 'defaulthost'), |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
42 'defaultauthors': ('hgsubversion', 'defaultauthors'), |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
43 'usebranchnames': ('hgsubversion', 'usebranchnames'), |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
44 } |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
45 |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
46 def wrapper(orig, ui, repo, *args, **opts): |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
47 """ |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
48 Subversion repositories are also supported for this command. See |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
49 `hg help %(extension)s` for details. |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
50 """ |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
51 for opt, (section, name) in optionmap.iteritems(): |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
52 if opt in opts: |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
53 if isinstance(repo, str): |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
54 ui.setconfig(section, name, opts.pop(opt)) |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
55 else: |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
56 repo.ui.setconfig(section, name, opts.pop(opt)) |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
57 |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
58 return orig(ui, repo, *args, **opts) |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
59 |
256
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
60 def uisetup(ui): |
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
61 """Do our UI setup. |
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
62 |
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
63 Does the following wrappings: |
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
64 * parent -> utility_commands.parent |
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
65 * outgoing -> utility_commands.outgoing |
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
66 """ |
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
67 entry = extensions.wrapcommand(commands.table, 'parents', |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
256
diff
changeset
|
68 wrappers.parent) |
256
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
69 entry[1].append(('', 'svn', None, "show parent svn revision instead")) |
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
70 entry = extensions.wrapcommand(commands.table, 'outgoing', |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
256
diff
changeset
|
71 wrappers.outgoing) |
256
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
72 entry[1].append(('', 'svn', None, "show revisions outgoing to subversion")) |
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
73 entry = extensions.wrapcommand(commands.table, 'diff', |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
256
diff
changeset
|
74 wrappers.diff) |
256
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
75 entry[1].append(('', 'svn', None, |
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
76 "show svn-style diffs, default against svn parent")) |
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
77 |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
78 newflags = (('A', 'authors', '', 'path to file containing username ' |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
79 'mappings for Subversion sources'), |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
80 ('', 'filemap', '', 'path to file containing rules for file ' |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
81 'name mapping used for sources)'), |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
82 ('T', 'tagpaths', ['tags'], 'list of paths to search for tags ' |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
83 'in Subversion repositories.')) |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
84 extname = __package__.split('_')[-1] |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
85 |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
86 for command in ['clone']: |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
87 doc = wrapper.__doc__.strip() % { 'extension': extname } |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
88 getattr(commands, command).__doc__ += doc |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
89 entry = extensions.wrapcommand(commands.table, command, wrapper) |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
90 entry[1].extend(newflags) |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
91 |
264
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
92 try: |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
93 rebase = extensions.find('rebase') |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
94 if rebase: |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
95 entry = extensions.wrapcommand(rebase.cmdtable, 'rebase', wrappers.rebase) |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
96 entry[1].append(('', 'svn', None, 'automatic svn rebase', )) |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
97 except: |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
98 pass |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
99 |
115
ed42f6e5705a
Clean up help text, document subcommands.
Luke Opperman <luke@loppear.com>
parents:
52
diff
changeset
|
100 |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
101 def svn(ui, repo, subcommand, *args, **opts): |
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
102 '''see detailed help for list of subcommands''' |
248
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
103 |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
104 # guess command if prefix |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
251
diff
changeset
|
105 if subcommand not in svncommands.table: |
248
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
106 candidates = [] |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
251
diff
changeset
|
107 for c in svncommands.table: |
248
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
108 if c.startswith(subcommand): |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
109 candidates.append(c) |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
110 if len(candidates) == 1: |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
111 subcommand = candidates[0] |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
112 |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
113 path = os.path.dirname(repo.path) |
209
d06572495c5e
Better error message when we encounter an unknown SSL cert.
Augie Fackler <durin42@gmail.com>
parents:
199
diff
changeset
|
114 try: |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
251
diff
changeset
|
115 commandfunc = svncommands.table[subcommand] |
273
e0f9fa0acc03
Fix the nourl check to use the command name, instead of the function
Daniel Tang <dytang@cs.purdue.edu>
parents:
264
diff
changeset
|
116 if subcommand not in svncommands.nourl: |
248
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
117 opts['svn_url'] = open(os.path.join(repo.path, 'svn', 'url')).read() |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
118 return commandfunc(ui, args=args, hg_repo_path=path, repo=repo, **opts) |
209
d06572495c5e
Better error message when we encounter an unknown SSL cert.
Augie Fackler <durin42@gmail.com>
parents:
199
diff
changeset
|
119 except core.SubversionException, e: |
224
2165461d2dd8
Exception clean-ups; use symbolic names & avoid Python 2.6 deprecations.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
209
diff
changeset
|
120 if e.apr_err == core.SVN_ERR_RA_SERF_SSL_CERT_UNTRUSTED: |
248
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
121 raise hgutil.Abort('It appears svn does not trust the ssl cert for this site.\n' |
209
d06572495c5e
Better error message when we encounter an unknown SSL cert.
Augie Fackler <durin42@gmail.com>
parents:
199
diff
changeset
|
122 'Please try running svn ls on that url first.') |
d06572495c5e
Better error message when we encounter an unknown SSL cert.
Augie Fackler <durin42@gmail.com>
parents:
199
diff
changeset
|
123 raise |
248
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
124 except TypeError: |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
125 tb = traceback.extract_tb(sys.exc_info()[2]) |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
126 if len(tb) == 1: |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
127 ui.status('Bad arguments for subcommand %s\n' % subcommand) |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
128 else: |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
129 raise |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
130 except KeyError, e: |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
131 tb = traceback.extract_tb(sys.exc_info()[2]) |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
132 if len(tb) == 1: |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
133 ui.status('Unknown subcommand %s\n' % subcommand) |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
134 else: |
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
135 raise |
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
136 |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
304
diff
changeset
|
137 def reposetup(ui, repo): |
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
304
diff
changeset
|
138 if repo.local(): |
328
48ec2d62dc29
Rename tag_repo.py to svnrepo.py and get rid of the 'fake' tags.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
326
diff
changeset
|
139 svnrepo.generate_repo_class(ui, repo) |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
140 |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
329
diff
changeset
|
141 for scheme in schemes: |
328
48ec2d62dc29
Rename tag_repo.py to svnrepo.py and get rid of the 'fake' tags.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
326
diff
changeset
|
142 hg.schemes[scheme] = svnrepo |
142
42958d9de864
documentation update
Alexander Solovyov <piranha@piranha.org.ua>
parents:
140
diff
changeset
|
143 |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
144 cmdtable = { |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
145 "svn": |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
146 (svn, |
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
147 [('u', 'svn-url', '', 'path to the Subversion server.'), |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
148 ('', 'stupid', False, 'be stupid and use diffy replay.'), |
167
3cd6a7354207
fetch: Add support for an authormap which can rename authors, intended for
Graham Booker <gbooker@cod3r.com>
parents:
143
diff
changeset
|
149 ('A', 'authors', '', 'username mapping filename'), |
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
150 ('', 'filemap', '', |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
151 'remap file to exclude paths or include only certain paths'), |
199
91db8fc049b0
Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents:
185
diff
changeset
|
152 ('', 'force', False, 'force an operation to happen'), |
234
33e885f5f86a
Add --username and --password options to all commands
Daniel Tang <dytang@cs.purdue.edu>
parents:
224
diff
changeset
|
153 ('', 'username', '', 'username for authentication'), |
33e885f5f86a
Add --username and --password options to all commands
Daniel Tang <dytang@cs.purdue.edu>
parents:
224
diff
changeset
|
154 ('', 'password', '', 'password for authentication'), |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
155 ], |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
251
diff
changeset
|
156 svncommands._helpgen(), |
115
ed42f6e5705a
Clean up help text, document subcommands.
Luke Opperman <luke@loppear.com>
parents:
52
diff
changeset
|
157 ), |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
158 } |