Mercurial > hgsubversion
annotate hgsubversion/__init__.py @ 722:aa24148a7454
uisetup: add fromsvn() and svnrev() revsets.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Tue, 05 Oct 2010 16:26:19 +0200 |
parents | cb32d90f915e |
children | 467b95348e6a |
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 |
332
56d877e6ccbb
__init__: rewrite extension docstring to be slightly less hostile.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
331
diff
changeset
|
3 hgsubversion is an extension for Mercurial that allows it to act as a Subversion |
56d877e6ccbb
__init__: rewrite extension docstring to be slightly less hostile.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
331
diff
changeset
|
4 client, offering fast, incremental and bidirectional synchronisation. |
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
5 |
524
30e885106dab
__init__: update docstring to reflect recent change to README
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
507
diff
changeset
|
6 At this point, hgsubversion is usable by users reasonably familiar with |
30e885106dab
__init__: update docstring to reflect recent change to README
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
507
diff
changeset
|
7 Mercurial as a VCS. It's not recommended to dive into hgsubversion as an |
30e885106dab
__init__: update docstring to reflect recent change to README
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
507
diff
changeset
|
8 introduction to Mercurial, since hgsubversion "bends the rules" a little |
30e885106dab
__init__: update docstring to reflect recent change to README
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
507
diff
changeset
|
9 and violates some of the typical assumptions of early Mercurial users. |
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
10 |
332
56d877e6ccbb
__init__: rewrite extension docstring to be slightly less hostile.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
331
diff
changeset
|
11 Before using hgsubversion, we *strongly* encourage running the |
428
96b4ae475941
Fix syntax highlighting in emacs.
Augie Fackler <durin42@gmail.com>
parents:
404
diff
changeset
|
12 automated tests. See 'README' in the hgsubversion directory for |
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
13 details. |
332
56d877e6ccbb
__init__: rewrite extension docstring to be slightly less hostile.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
331
diff
changeset
|
14 |
660
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
15 For more information and instructions, see :hg:`help subversion`. |
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
16 ''' |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
17 |
52
fb1d911bb0be
svnclone now updates to the tip revision if it is the initial clone.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
18 import os |
251
23b02f892d9b
Fix up imports in __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
248
diff
changeset
|
19 import sys |
23b02f892d9b
Fix up imports in __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
248
diff
changeset
|
20 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
|
21 |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
22 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
|
23 from mercurial import extensions |
660
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
24 from mercurial import help |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
304
diff
changeset
|
25 from mercurial import hg |
248
a9134fa28d15
Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
26 from mercurial import util as hgutil |
429
a5a475dced59
blacklist svn for demandimport.
Augie Fackler <durin42@gmail.com>
parents:
428
diff
changeset
|
27 from mercurial import demandimport |
471
893e40e97f6c
Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents:
469
diff
changeset
|
28 demandimport.ignore.extend([ |
893e40e97f6c
Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents:
469
diff
changeset
|
29 'svn', |
893e40e97f6c
Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents:
469
diff
changeset
|
30 'svn.client', |
893e40e97f6c
Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents:
469
diff
changeset
|
31 'svn.core', |
893e40e97f6c
Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents:
469
diff
changeset
|
32 'svn.delta', |
893e40e97f6c
Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents:
469
diff
changeset
|
33 'svn.ra', |
893e40e97f6c
Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents:
469
diff
changeset
|
34 ]) |
209
d06572495c5e
Better error message when we encounter an unknown SSL cert.
Augie Fackler <durin42@gmail.com>
parents:
199
diff
changeset
|
35 |
687
d424bd1ac647
templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents:
684
diff
changeset
|
36 try: |
d424bd1ac647
templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents:
684
diff
changeset
|
37 from mercurial import templatekw |
d424bd1ac647
templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents:
684
diff
changeset
|
38 # force demandimport to load templatekw |
d424bd1ac647
templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents:
684
diff
changeset
|
39 templatekw.keywords |
d424bd1ac647
templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents:
684
diff
changeset
|
40 except ImportError: |
d424bd1ac647
templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents:
684
diff
changeset
|
41 templatekw = None |
d424bd1ac647
templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents:
684
diff
changeset
|
42 |
722
aa24148a7454
uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
707
diff
changeset
|
43 try: |
aa24148a7454
uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
707
diff
changeset
|
44 from mercurial import revset |
aa24148a7454
uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
707
diff
changeset
|
45 # force demandimport to load revset |
aa24148a7454
uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
707
diff
changeset
|
46 revset.methods |
aa24148a7454
uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
707
diff
changeset
|
47 except ImportError: |
aa24148a7454
uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
707
diff
changeset
|
48 revset = None |
aa24148a7454
uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
707
diff
changeset
|
49 |
241
4950b18cf949
Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
234
diff
changeset
|
50 import svncommands |
440
80909328aef1
move remaining cmdutils into util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
429
diff
changeset
|
51 import util |
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
|
52 import svnrepo |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
256
diff
changeset
|
53 import wrappers |
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
|
54 |
403
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
55 svnopts = [ |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
56 ('', 'stupid', None, |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
57 'use slower, but more compatible, protocol for Subversion'), |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
58 ] |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
59 |
506
b5f24dd948af
__init__: document wrapping commands more clearly
Augie Fackler <durin42@gmail.com>
parents:
505
diff
changeset
|
60 # generic means it picks up all options from svnopts |
b5f24dd948af
__init__: document wrapping commands more clearly
Augie Fackler <durin42@gmail.com>
parents:
505
diff
changeset
|
61 # fixdoc means update the docstring |
b5f24dd948af
__init__: document wrapping commands more clearly
Augie Fackler <durin42@gmail.com>
parents:
505
diff
changeset
|
62 # TODO: fixdoc hoses l18n |
403
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
63 wrapcmds = { # cmd: generic, target, fixdoc, ppopts, opts |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
64 'parents': (False, None, False, False, [ |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
65 ('', 'svn', None, 'show parent svn revision instead'), |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
66 ]), |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
67 'diff': (False, None, False, False, [ |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
68 ('', 'svn', None, 'show svn diffs against svn parent'), |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
69 ]), |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
70 'pull': (True, 'sources', True, True, []), |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
71 'push': (True, 'destinations', True, True, []), |
404
28e4b47b2179
add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
403
diff
changeset
|
72 'incoming': (False, 'sources', True, True, []), |
507
4ce09bf4d382
wrappers: wrap version with a --svn flag
Augie Fackler <durin42@gmail.com>
parents:
506
diff
changeset
|
73 'version': (False, None, False, False, [ |
4ce09bf4d382
wrappers: wrap version with a --svn flag
Augie Fackler <durin42@gmail.com>
parents:
506
diff
changeset
|
74 ('', 'svn', None, 'print hgsubversion information as well')]), |
403
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
75 'clone': (False, 'sources', True, True, [ |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
76 ('T', 'tagpaths', '', |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
77 'list of paths to search for tags in Subversion repositories'), |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
78 ('A', 'authors', '', |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
79 'file mapping Subversion usernames to Mercurial authors'), |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
80 ('', 'filemap', '', |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
81 'file containing rules for remapping Subversion repository paths'), |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
471
diff
changeset
|
82 ('', 'layout', 'auto', ('import standard layout or single ' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
471
diff
changeset
|
83 'directory? Can be standard, single, or auto.')), |
574
8e025a6f0db4
add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
84 ('', 'branchmap', '', 'file containing rules for branch conversion'), |
651
827547493112
clone: allow specifying a start revision.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
618
diff
changeset
|
85 ('', 'startrev', '', ('convert Subversion revisions starting at the one ' |
827547493112
clone: allow specifying a start revision.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
618
diff
changeset
|
86 'specified, either an integer revision or HEAD; ' |
827547493112
clone: allow specifying a start revision.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
618
diff
changeset
|
87 'HEAD causes only the latest revision to be ' |
827547493112
clone: allow specifying a start revision.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
618
diff
changeset
|
88 'pulled')), |
403
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
89 ]), |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
90 } |
342
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
91 |
618
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
92 |
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
93 # only need the discovery variant of this code when we drop hg < 1.6 |
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
94 try: |
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
95 from mercurial import discovery |
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
96 def findoutgoing(orig, *args, **opts): |
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
97 capable = getattr(args[1], 'capable', lambda x: False) |
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
98 if capable('subversion'): |
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
99 return wrappers.outgoing(*args, **opts) |
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
100 else: |
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
101 return orig(*args, **opts) |
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
102 extensions.wrapfunction(discovery, 'findoutgoing', findoutgoing) |
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
103 except ImportError: |
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
104 pass |
82bfc96a1311
svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents:
599
diff
changeset
|
105 |
256
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
106 def uisetup(ui): |
403
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
107 """insert command wrappers for a bunch of commands""" |
402
d453cf1aafa3
uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
108 docvals = {'extension': 'hgsubversion'} |
403
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
109 for cmd, (generic, target, fixdoc, ppopts, opts) in wrapcmds.iteritems(): |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
110 |
504
bc117ea4c95a
do not assume that doc-strings are present.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
503
diff
changeset
|
111 if fixdoc and wrappers.generic.__doc__: |
403
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
112 docvals['command'] = cmd |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
113 docvals['Command'] = cmd.capitalize() |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
114 docvals['target'] = target |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
115 doc = wrappers.generic.__doc__.strip() % docvals |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
116 fn = getattr(commands, cmd) |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
117 fn.__doc__ = fn.__doc__.rstrip() + '\n\n ' + doc |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
118 |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
119 wrapped = generic and wrappers.generic or getattr(wrappers, cmd) |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
120 entry = extensions.wrapcommand(commands.table, cmd, wrapped) |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
121 if ppopts: |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
122 entry[1].extend(svnopts) |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
123 if opts: |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
124 entry[1].extend(opts) |
337
46e69be8e2c8
Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents:
332
diff
changeset
|
125 |
264
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
126 try: |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
127 rebase = extensions.find('rebase') |
403
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
128 if not rebase: |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
129 return |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
130 entry = extensions.wrapcommand(rebase.cmdtable, 'rebase', wrappers.rebase) |
37c96b78b8c0
uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
402
diff
changeset
|
131 entry[1].append(('', 'svn', None, 'automatic svn rebase')) |
264
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
132 except: |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
133 pass |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
134 |
660
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
135 helpdir = os.path.join(os.path.dirname(__file__), 'help') |
115
ed42f6e5705a
Clean up help text, document subcommands.
Luke Opperman <luke@loppear.com>
parents:
52
diff
changeset
|
136 |
660
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
137 entries = ( |
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
138 (['subversion'], |
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
139 "Working with Subversion Repositories", |
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
140 lambda: open(os.path.join(helpdir, 'subversion.rst')).read()), |
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
141 ) |
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
142 |
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
143 # in 1.6 and earler the help table is a tuple |
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
144 if getattr(help.helptable, 'extend', None): |
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
145 help.helptable.extend(entries) |
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
146 else: |
67b54cb38843
__init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
651
diff
changeset
|
147 help.helptable = help.helptable + entries |
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
148 |
707
cb32d90f915e
templatekw: clean up implementation & test; add help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
701
diff
changeset
|
149 if templatekw: |
cb32d90f915e
templatekw: clean up implementation & test; add help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
701
diff
changeset
|
150 templatekw.keywords.update(util.templatekeywords) |
684
8687c5aa4f35
Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
660
diff
changeset
|
151 |
722
aa24148a7454
uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
707
diff
changeset
|
152 if revset: |
aa24148a7454
uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
707
diff
changeset
|
153 revset.symbols.update(util.revsets) |
aa24148a7454
uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
707
diff
changeset
|
154 |
326
33736e2e25f0
alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
304
diff
changeset
|
155 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
|
156 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
|
157 svnrepo.generate_repo_class(ui, repo) |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
158 |
505
e508a718779c
fallback to the previous scheme for file repositories.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
504
diff
changeset
|
159 _old_local = hg.schemes['file'] |
342
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
160 def _lookup(url): |
440
80909328aef1
move remaining cmdutils into util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
429
diff
changeset
|
161 if util.islocalrepo(url): |
342
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
162 return svnrepo |
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
163 else: |
505
e508a718779c
fallback to the previous scheme for file repositories.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
504
diff
changeset
|
164 return _old_local(url) |
342
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
165 |
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
166 # install scheme handlers |
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
167 hg.schemes.update({ 'file': _lookup, 'http': svnrepo, 'https': svnrepo, |
469
5567af673f83
Revive svn+http(s) URLs support (issue94)
Patrick Mezard <pmezard@gmail.com>
parents:
463
diff
changeset
|
168 'svn': svnrepo, 'svn+ssh': svnrepo, 'svn+http': svnrepo, |
5567af673f83
Revive svn+http(s) URLs support (issue94)
Patrick Mezard <pmezard@gmail.com>
parents:
463
diff
changeset
|
169 'svn+https': svnrepo}) |
142
42958d9de864
documentation update
Alexander Solovyov <piranha@piranha.org.ua>
parents:
140
diff
changeset
|
170 |
573
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
524
diff
changeset
|
171 commands.optionalrepo += ' svn' |
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
524
diff
changeset
|
172 |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
173 cmdtable = { |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
174 "svn": |
599
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
175 (svncommands.svn, |
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
176 [('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
|
177 ('', '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
|
178 ('A', 'authors', '', 'username mapping filename'), |
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
179 ('', 'filemap', '', |
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
179
diff
changeset
|
180 '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
|
181 ('', '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
|
182 ('', 'username', '', 'username for authentication'), |
33e885f5f86a
Add --username and --password options to all commands
Daniel Tang <dytang@cs.purdue.edu>
parents:
224
diff
changeset
|
183 ('', 'password', '', 'password for authentication'), |
503
00ecb2bc005c
Add a -r option to hg svn. Use with hg svn info to change the mercurial rev.
Jason Ostrander <jason@sentilla.com>
parents:
499
diff
changeset
|
184 ('r', 'rev', '', 'Mercurial revision'), |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
185 ], |
598
e432b61c6d74
Use Mercurial-provided infrastructure for `svn' metacommand help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
580
diff
changeset
|
186 'hg svn <subcommand> ...', |
115
ed42f6e5705a
Clean up help text, document subcommands.
Luke Opperman <luke@loppear.com>
parents:
52
diff
changeset
|
187 ), |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
188 } |
342
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
189 |
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
190 # only these methods are public |
76c833526fbc
Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
191 __all__ = ('cmdtable', 'reposetup', 'uisetup') |