annotate hgsubversion/__init__.py @ 1094:9a7e3dbd0f6e

layouts: add support for an infix between tbt and the hg root
author David Schleimer <dschleimer@fb.com>
date Wed, 11 Sep 2013 10:55:01 -0700
parents 791382a21cc4
children 48935ea2090f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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:
800
baa9851204e7 Fix code indentation
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 763
diff changeset
41 templatekw = None
687
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:
800
baa9851204e7 Fix code indentation
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 763
diff changeset
48 revset = None
722
aa24148a7454 uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 707
diff changeset
49
762
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 753
diff changeset
50 try:
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 753
diff changeset
51 from mercurial import subrepo
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 753
diff changeset
52 # require svnsubrepo and hg >= 1.7.1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 753
diff changeset
53 subrepo.svnsubrepo
763
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
54 hgutil.checknlink
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
55 except (ImportError, AttributeError), e:
762
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 753
diff changeset
56 subrepo = None
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 753
diff changeset
57
241
4950b18cf949 Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 234
diff changeset
58 import svncommands
440
80909328aef1 move remaining cmdutils into util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 429
diff changeset
59 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
60 import svnrepo
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 256
diff changeset
61 import wrappers
762
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 753
diff changeset
62 import svnexternals
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
63
403
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
64 svnopts = [
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
65 ('', 'stupid', None,
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
66 '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
67 ]
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
68
506
b5f24dd948af __init__: document wrapping commands more clearly
Augie Fackler <durin42@gmail.com>
parents: 505
diff changeset
69 # 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
70 # fixdoc means update the docstring
b5f24dd948af __init__: document wrapping commands more clearly
Augie Fackler <durin42@gmail.com>
parents: 505
diff changeset
71 # 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
72 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
73 '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
74 ('', '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
75 ]),
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
76 '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
77 ('', '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
78 ]),
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
79 '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
80 'push': (True, 'destinations', True, True, []),
404
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
81 'incoming': (False, 'sources', True, True, []),
507
4ce09bf4d382 wrappers: wrap version with a --svn flag
Augie Fackler <durin42@gmail.com>
parents: 506
diff changeset
82 'version': (False, None, False, False, [
4ce09bf4d382 wrappers: wrap version with a --svn flag
Augie Fackler <durin42@gmail.com>
parents: 506
diff changeset
83 ('', '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
84 '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
85 ('T', 'tagpaths', '',
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
86 'list of paths to search for tags in Subversion repositories'),
1093
791382a21cc4 layouts: add support for configuring branches directory
David Schleimer <dschleimer@fb.com>
parents: 1009
diff changeset
87 ('', 'branchdir', '',
791382a21cc4 layouts: add support for configuring branches directory
David Schleimer <dschleimer@fb.com>
parents: 1009
diff changeset
88 'path to search for branches in subversion repositories'),
1094
9a7e3dbd0f6e layouts: add support for an infix between tbt and the hg root
David Schleimer <dschleimer@fb.com>
parents: 1093
diff changeset
89 ('', 'infix', '',
9a7e3dbd0f6e layouts: add support for an infix between tbt and the hg root
David Schleimer <dschleimer@fb.com>
parents: 1093
diff changeset
90 'path relative to trunk, branch an tag dirs to import'),
403
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
91 ('A', 'authors', '',
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
92 '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
93 ('', 'filemap', '',
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
94 'file containing rules for remapping Subversion repository paths'),
499
1fd3cfa47c5e Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents: 471
diff changeset
95 ('', 'layout', 'auto', ('import standard layout or single '
1fd3cfa47c5e Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents: 471
diff changeset
96 '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
97 ('', 'branchmap', '', 'file containing rules for branch conversion'),
729
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 722
diff changeset
98 ('', 'tagmap', '', 'file containing rules for renaming tags'),
651
827547493112 clone: allow specifying a start revision.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 618
diff changeset
99 ('', '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
100 '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
101 '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
102 'pulled')),
403
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
103 ]),
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
104 }
342
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 340
diff changeset
105
618
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
106 try:
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
107 from mercurial import discovery
805
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
108 def findcommonoutgoing(orig, *args, **opts):
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
109 capable = getattr(args[1], 'capable', lambda x: False)
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
110 if capable('subversion'):
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
111 return wrappers.findcommonoutgoing(*args, **opts)
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
112 else:
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
113 return orig(*args, **opts)
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
114 extensions.wrapfunction(discovery, 'findcommonoutgoing', findcommonoutgoing)
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
115 except AttributeError:
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
116 # only need the discovery variant of this code when we drop hg < 1.6
618
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
117 def findoutgoing(orig, *args, **opts):
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
118 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
119 if capable('subversion'):
805
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
120 return wrappers.findoutgoing(*args, **opts)
618
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
121 else:
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
122 return orig(*args, **opts)
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
123 extensions.wrapfunction(discovery, 'findoutgoing', findoutgoing)
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
124 except ImportError:
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
125 pass
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
126
753
b218d2bb8c45 rename our uisetup initialization method into extsetup
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
127 def extsetup():
403
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
128 """insert command wrappers for a bunch of commands"""
753
b218d2bb8c45 rename our uisetup initialization method into extsetup
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
129 # add the ui argument to this function once we drop support for 1.3
b218d2bb8c45 rename our uisetup initialization method into extsetup
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
130
402
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 384
diff changeset
131 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
132 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
133
504
bc117ea4c95a do not assume that doc-strings are present.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 503
diff changeset
134 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
135 docvals['command'] = cmd
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
136 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
137 docvals['target'] = target
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
138 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
139 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
140 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
141
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
142 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
143 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
144 if ppopts:
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
145 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
146 if opts:
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
147 entry[1].extend(opts)
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 332
diff changeset
148
264
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
149 try:
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
150 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
151 if not rebase:
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
152 return
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
153 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
154 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
155 except:
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
156 pass
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
157
660
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
158 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
159
660
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
160 entries = (
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
161 (['subversion'],
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
162 "Working with Subversion Repositories",
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
163 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
164 )
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
165
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
166 # 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
167 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
168 help.helptable.extend(entries)
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
169 else:
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
170 help.helptable = help.helptable + entries
185
57355b0e7bd1 Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents: 179
diff changeset
171
707
cb32d90f915e templatekw: clean up implementation & test; add help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 701
diff changeset
172 if templatekw:
cb32d90f915e templatekw: clean up implementation & test; add help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 701
diff changeset
173 templatekw.keywords.update(util.templatekeywords)
684
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents: 660
diff changeset
174
722
aa24148a7454 uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 707
diff changeset
175 if revset:
aa24148a7454 uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 707
diff changeset
176 revset.symbols.update(util.revsets)
aa24148a7454 uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 707
diff changeset
177
762
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 753
diff changeset
178 if subrepo:
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 753
diff changeset
179 subrepo.types['hgsubversion'] = svnexternals.svnsubrepo
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 753
diff changeset
180
326
33736e2e25f0 alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 304
diff changeset
181 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
182 if repo.local():
800
baa9851204e7 Fix code indentation
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 763
diff changeset
183 svnrepo.generate_repo_class(ui, repo)
849
4e43e30e3e7d Support non-standard tunnels
Will Wykeham <will@wykeham.net>
parents: 805
diff changeset
184 for tunnel in ui.configlist('hgsubversion', 'tunnels'):
4e43e30e3e7d Support non-standard tunnels
Will Wykeham <will@wykeham.net>
parents: 805
diff changeset
185 hg.schemes['svn+' + tunnel] = svnrepo
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
186
1009
f0bde4bf1f78 revsets: add support for 'r123' revision labels
Matt Mackall <mpm@selenic.com>
parents: 918
diff changeset
187 if revset and ui.configbool('hgsubversion', 'nativerevs'):
f0bde4bf1f78 revsets: add support for 'r123' revision labels
Matt Mackall <mpm@selenic.com>
parents: 918
diff changeset
188 extensions.wrapfunction(revset, 'stringset', util.revset_stringset)
f0bde4bf1f78 revsets: add support for 'r123' revision labels
Matt Mackall <mpm@selenic.com>
parents: 918
diff changeset
189
505
e508a718779c fallback to the previous scheme for file repositories.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 504
diff changeset
190 _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
191 def _lookup(url):
440
80909328aef1 move remaining cmdutils into util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 429
diff changeset
192 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
193 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
194 else:
505
e508a718779c fallback to the previous scheme for file repositories.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 504
diff changeset
195 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
196
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 340
diff changeset
197 # 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
198 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
199 '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
200 'svn+https': svnrepo})
142
42958d9de864 documentation update
Alexander Solovyov <piranha@piranha.org.ua>
parents: 140
diff changeset
201
573
00393e9abff8 svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 524
diff changeset
202 commands.optionalrepo += ' svn'
00393e9abff8 svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 524
diff changeset
203
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
204 cmdtable = {
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
205 "svn":
599
408869906fbf Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 598
diff changeset
206 (svncommands.svn,
185
57355b0e7bd1 Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents: 179
diff changeset
207 [('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
208 ('', '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
209 ('A', 'authors', '', 'username mapping filename'),
185
57355b0e7bd1 Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents: 179
diff changeset
210 ('', 'filemap', '',
57355b0e7bd1 Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents: 179
diff changeset
211 '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
212 ('', '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
213 ('', 'username', '', 'username for authentication'),
33e885f5f86a Add --username and --password options to all commands
Daniel Tang <dytang@cs.purdue.edu>
parents: 224
diff changeset
214 ('', '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
215 ('r', 'rev', '', 'Mercurial revision'),
918
761a87134501 rebuildmeta: accept unrelated svn repo with --unsafe-skip-uuid-check
Patrick Mezard <patrick@mezard.eu>
parents: 849
diff changeset
216 ('', 'unsafe-skip-uuid-check', False,
761a87134501 rebuildmeta: accept unrelated svn repo with --unsafe-skip-uuid-check
Patrick Mezard <patrick@mezard.eu>
parents: 849
diff changeset
217 'skip repository uuid check in rebuildmeta'),
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
218 ],
598
e432b61c6d74 Use Mercurial-provided infrastructure for `svn' metacommand help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 580
diff changeset
219 'hg svn <subcommand> ...',
115
ed42f6e5705a Clean up help text, document subcommands.
Luke Opperman <luke@loppear.com>
parents: 52
diff changeset
220 ),
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
221 }
342
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 340
diff changeset
222
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 340
diff changeset
223 # 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
224 __all__ = ('cmdtable', 'reposetup', 'uisetup')