annotate hgsubversion/__init__.py @ 1542:08ea19b989c3 1.9

testedwith: add hg 4.4
author Augie Fackler <raf@durin42.com>
date Wed, 01 Nov 2017 22:37:11 -0400
parents c0fc42713ecb
children 601eaa89ca98
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
1542
08ea19b989c3 testedwith: add hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1540
diff changeset
18 testedwith = '3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4'
1304
c1756971f882 __init__: record the versions of Mercurial hgsubversion supports
Augie Fackler <raf@durin42.com>
parents: 1247
diff changeset
19
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 import os
251
23b02f892d9b Fix up imports in __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 248
diff changeset
21 import sys
23b02f892d9b Fix up imports in __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 248
diff changeset
22 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
23
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 from mercurial import commands
1246
2179747e7fea push: wrap exchange.push when localrepository.push isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1113
diff changeset
25 try:
2179747e7fea push: wrap exchange.push when localrepository.push isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1113
diff changeset
26 from mercurial import exchange
2179747e7fea push: wrap exchange.push when localrepository.push isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1113
diff changeset
27 exchange.push # existed in first iteration of this file
2179747e7fea push: wrap exchange.push when localrepository.push isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1113
diff changeset
28 except ImportError:
2179747e7fea push: wrap exchange.push when localrepository.push isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1113
diff changeset
29 # We only *use* the exchange module in hg 3.2+, so this is safe
2179747e7fea push: wrap exchange.push when localrepository.push isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1113
diff changeset
30 pass
256
7932d098cb5f Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents: 253
diff changeset
31 from mercurial import extensions
660
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
32 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
33 from mercurial import hg
1246
2179747e7fea push: wrap exchange.push when localrepository.push isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1113
diff changeset
34 from mercurial import localrepo
248
a9134fa28d15 Move svncommand code into __init__.py.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 247
diff changeset
35 from mercurial import util as hgutil
429
a5a475dced59 blacklist svn for demandimport.
Augie Fackler <durin42@gmail.com>
parents: 428
diff changeset
36 from mercurial import demandimport
471
893e40e97f6c Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents: 469
diff changeset
37 demandimport.ignore.extend([
893e40e97f6c Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents: 469
diff changeset
38 'svn',
893e40e97f6c Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents: 469
diff changeset
39 'svn.client',
893e40e97f6c Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents: 469
diff changeset
40 'svn.core',
893e40e97f6c Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents: 469
diff changeset
41 'svn.delta',
893e40e97f6c Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents: 469
diff changeset
42 'svn.ra',
893e40e97f6c Bypass demandimport for all svn submodules
Patrick Mezard <pmezard@gmail.com>
parents: 469
diff changeset
43 ])
209
d06572495c5e Better error message when we encounter an unknown SSL cert.
Augie Fackler <durin42@gmail.com>
parents: 199
diff changeset
44
1112
0c2eef372483 init: remove pre-1.6 revset code
Sean Farley <sean.michael.farley@gmail.com>
parents: 1111
diff changeset
45 from mercurial import revset
1113
c8aa5616eec5 init: remove pre-1.7 subrepo code
Sean Farley <sean.michael.farley@gmail.com>
parents: 1112
diff changeset
46 from mercurial import subrepo
762
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 753
diff changeset
47
241
4950b18cf949 Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 234
diff changeset
48 import svncommands
440
80909328aef1 move remaining cmdutils into util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 429
diff changeset
49 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
50 import svnrepo
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 256
diff changeset
51 import wrappers
762
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 753
diff changeset
52 import svnexternals
1406
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
53 import compathacks
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'),
1093
791382a21cc4 layouts: add support for configuring branches directory
David Schleimer <dschleimer@fb.com>
parents: 1009
diff changeset
78 ('', 'branchdir', '',
791382a21cc4 layouts: add support for configuring branches directory
David Schleimer <dschleimer@fb.com>
parents: 1009
diff changeset
79 'path to search for branches in subversion repositories'),
1319
43a365f5d13c Allow changing the path to the trunk
Francois Dinel <fdinel@gmail.com>
parents: 1304
diff changeset
80 ('', 'trunkdir', '',
43a365f5d13c Allow changing the path to the trunk
Francois Dinel <fdinel@gmail.com>
parents: 1304
diff changeset
81 'path to trunk 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
82 ('', 'infix', '',
9a7e3dbd0f6e layouts: add support for an infix between tbt and the hg root
David Schleimer <dschleimer@fb.com>
parents: 1093
diff changeset
83 '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
84 ('A', 'authors', '',
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
85 '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
86 ('', 'filemap', '',
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
87 'file containing rules for remapping Subversion repository paths'),
499
1fd3cfa47c5e Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents: 471
diff changeset
88 ('', 'layout', 'auto', ('import standard layout or single '
1fd3cfa47c5e Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents: 471
diff changeset
89 '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
90 ('', 'branchmap', '', 'file containing rules for branch conversion'),
729
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 722
diff changeset
91 ('', '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
92 ('', '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
93 '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
94 '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
95 'pulled')),
403
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
96 ]),
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
97 }
342
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 340
diff changeset
98
618
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
99 try:
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
100 from mercurial import discovery
805
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
101 def findcommonoutgoing(orig, *args, **opts):
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
102 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
103 if capable('subversion'):
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
104 return wrappers.findcommonoutgoing(*args, **opts)
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
105 else:
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
106 return orig(*args, **opts)
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
107 extensions.wrapfunction(discovery, 'findcommonoutgoing', findcommonoutgoing)
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
108 except AttributeError:
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
109 # 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
110 def findoutgoing(orig, *args, **opts):
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
111 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
112 if capable('subversion'):
805
a3f727c41c1d Fix breakage introduced by discovery refactoring
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 800
diff changeset
113 return wrappers.findoutgoing(*args, **opts)
618
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
114 else:
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
115 return orig(*args, **opts)
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
116 extensions.wrapfunction(discovery, 'findoutgoing', findoutgoing)
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
117 except ImportError:
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
118 pass
82bfc96a1311 svnrepo: support new discovery module introduced in 3d0591a66118
Augie Fackler <durin42@gmail.com>
parents: 599
diff changeset
119
1109
48935ea2090f init: remove pre-1.3 code from extsetup
Sean Farley <sean.michael.farley@gmail.com>
parents: 1094
diff changeset
120 def extsetup(ui):
403
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
121 """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
122
402
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 384
diff changeset
123 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
124 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
125
504
bc117ea4c95a do not assume that doc-strings are present.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 503
diff changeset
126 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
127 docvals['command'] = cmd
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
128 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
129 docvals['target'] = target
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
130 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
131 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
132 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
133
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
134 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
135 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
136 if ppopts:
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
137 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
138 if opts:
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
139 entry[1].extend(opts)
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 332
diff changeset
140
264
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
141 try:
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
142 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
143 if not rebase:
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
144 return
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
145 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
146 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
147 except:
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
148 pass
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
149
1246
2179747e7fea push: wrap exchange.push when localrepository.push isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1113
diff changeset
150 if not hgutil.safehasattr(localrepo.localrepository, 'push'):
2179747e7fea push: wrap exchange.push when localrepository.push isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1113
diff changeset
151 # Mercurial >= 3.2
2179747e7fea push: wrap exchange.push when localrepository.push isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1113
diff changeset
152 extensions.wrapfunction(exchange, 'push', wrappers.exchangepush)
1247
3a4d74823187 pull: wrap exchange.pull if localrepository.pull isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1246
diff changeset
153 if not hgutil.safehasattr(localrepo.localrepository, 'pull'):
3a4d74823187 pull: wrap exchange.pull if localrepository.pull isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1246
diff changeset
154 # Mercurial >= 3.2
3a4d74823187 pull: wrap exchange.pull if localrepository.pull isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1246
diff changeset
155 extensions.wrapfunction(exchange, 'pull', wrappers.exchangepull)
1246
2179747e7fea push: wrap exchange.push when localrepository.push isn't available
Siddharth Agarwal <sid0@fb.com>
parents: 1113
diff changeset
156
660
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
157 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
158
660
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
159 entries = (
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
160 (['subversion'],
67b54cb38843 __init__: activate & advertise the new help topic.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 651
diff changeset
161 "Working with Subversion Repositories",
1357
44895e2abff2 help: ignore argument passed to doc loader
Yuya Nishihara <yuya@tcha.org>
parents: 1334
diff changeset
162 # Mercurial >= 3.6: doc(ui)
44895e2abff2 help: ignore argument passed to doc loader
Yuya Nishihara <yuya@tcha.org>
parents: 1334
diff changeset
163 lambda *args: open(os.path.join(helpdir, 'subversion.rst')).read()),
660
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
1111
815e5cbc7ea7 init: remove pre-1.6 code from extsetup
Sean Farley <sean.michael.farley@gmail.com>
parents: 1110
diff changeset
166 help.helptable.extend(entries)
185
57355b0e7bd1 Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents: 179
diff changeset
167
1112
0c2eef372483 init: remove pre-1.6 revset code
Sean Farley <sean.michael.farley@gmail.com>
parents: 1111
diff changeset
168 revset.symbols.update(util.revsets)
722
aa24148a7454 uisetup: add fromsvn() and svnrev() revsets.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 707
diff changeset
169
1113
c8aa5616eec5 init: remove pre-1.7 subrepo code
Sean Farley <sean.michael.farley@gmail.com>
parents: 1112
diff changeset
170 subrepo.types['hgsubversion'] = svnexternals.svnsubrepo
762
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 753
diff changeset
171
326
33736e2e25f0 alternate approach for supporting svn schemes for repository paths
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 304
diff changeset
172 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
173 if repo.local():
800
baa9851204e7 Fix code indentation
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 763
diff changeset
174 svnrepo.generate_repo_class(ui, repo)
849
4e43e30e3e7d Support non-standard tunnels
Will Wykeham <will@wykeham.net>
parents: 805
diff changeset
175 for tunnel in ui.configlist('hgsubversion', 'tunnels'):
4e43e30e3e7d Support non-standard tunnels
Will Wykeham <will@wykeham.net>
parents: 805
diff changeset
176 hg.schemes['svn+' + tunnel] = svnrepo
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
177
1112
0c2eef372483 init: remove pre-1.6 revset code
Sean Farley <sean.michael.farley@gmail.com>
parents: 1111
diff changeset
178 if ui.configbool('hgsubversion', 'nativerevs'):
1009
f0bde4bf1f78 revsets: add support for 'r123' revision labels
Matt Mackall <mpm@selenic.com>
parents: 918
diff changeset
179 extensions.wrapfunction(revset, 'stringset', util.revset_stringset)
1334
9a78a6524f9d native revs: Match changes in core to fix native revs
Laurent Charignon <lcharignon@fb.com>
parents: 1319
diff changeset
180 revset.symbols['stringset'] = revset.stringset
9a78a6524f9d native revs: Match changes in core to fix native revs
Laurent Charignon <lcharignon@fb.com>
parents: 1319
diff changeset
181 revset.methods['string'] = revset.stringset
9a78a6524f9d native revs: Match changes in core to fix native revs
Laurent Charignon <lcharignon@fb.com>
parents: 1319
diff changeset
182 revset.methods['symbol'] = revset.stringset
1009
f0bde4bf1f78 revsets: add support for 'r123' revision labels
Matt Mackall <mpm@selenic.com>
parents: 918
diff changeset
183
505
e508a718779c fallback to the previous scheme for file repositories.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 504
diff changeset
184 _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
185 def _lookup(url):
440
80909328aef1 move remaining cmdutils into util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 429
diff changeset
186 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
187 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
188 else:
505
e508a718779c fallback to the previous scheme for file repositories.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 504
diff changeset
189 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
190
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 340
diff changeset
191 # 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
192 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
193 '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
194 'svn+https': svnrepo})
142
42958d9de864 documentation update
Alexander Solovyov <piranha@piranha.org.ua>
parents: 140
diff changeset
195
1377
2ae4fb5bfab9 svncommands: cope with aa73d6a5d9ea which removed optionalrepo
Augie Fackler <raf@durin42.com>
parents: 1370
diff changeset
196 if hgutil.safehasattr(commands, 'optionalrepo'):
2ae4fb5bfab9 svncommands: cope with aa73d6a5d9ea which removed optionalrepo
Augie Fackler <raf@durin42.com>
parents: 1370
diff changeset
197 commands.optionalrepo += ' svn'
573
00393e9abff8 svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 524
diff changeset
198
1512
6d0fe7ce9898 commands: fix command option registering
Durham Goode <durham@fb.com>
parents: 1506
diff changeset
199 svncommandopts = [
1505
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
200 ('u', 'svn-url', '', 'path to the Subversion server.'),
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
201 ('', 'stupid', False, 'be stupid and use diffy replay.'),
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
202 ('A', 'authors', '', 'username mapping filename'),
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
203 ('', 'filemap', '',
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
204 'remap file to exclude paths or include only certain paths'),
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
205 ('', 'force', False, 'force an operation to happen'),
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
206 ('', 'username', '', 'username for authentication'),
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
207 ('', 'password', '', 'password for authentication'),
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
208 ('r', 'rev', '', 'Mercurial revision'),
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
209 ('', 'unsafe-skip-uuid-check', False,
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
210 'skip repository uuid check in rebuildmeta'),
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
211 ]
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
212 svnusage = 'hg svn <subcommand> ...'
342
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 340
diff changeset
213
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 340
diff changeset
214 # 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
215 __all__ = ('cmdtable', 'reposetup', 'uisetup')
1403
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
216
1505
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
217 # set up commands and templatekeywords (written this way to maintain backwards
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
218 # compatibility until we drop support for 3.7 for templatekeywords and 4.3 for
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
219 # commands)
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
220 cmdtable = {
1512
6d0fe7ce9898 commands: fix command option registering
Durham Goode <durham@fb.com>
parents: 1506
diff changeset
221 "svn": (svncommands.svn, svncommandopts, svnusage),
1505
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
222 }
1538
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
223 configtable = {}
1406
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
224 try:
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
225 from mercurial import registrar
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
226 templatekeyword = registrar.templatekeyword()
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
227 loadkeyword = lambda registrarobj: None # no-op
1505
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
228
1506
332e803044e5 commands: fix registrar check
Durham Goode <durham@fb.com>
parents: 1505
diff changeset
229 if hgutil.safehasattr(registrar, 'command'):
1505
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
230 cmdtable = {}
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
231 command = registrar.command(cmdtable)
1512
6d0fe7ce9898 commands: fix command option registering
Durham Goode <durham@fb.com>
parents: 1506
diff changeset
232 @command('svn', svncommandopts, svnusage)
1505
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
233 def svncommand(*args, **kwargs):
6f2c7b5940f6 commands: update to work with new registrar.commands()
Durham Goode <durham@fb.com>
parents: 1479
diff changeset
234 return svncommands.svn(*args, **kwargs)
1538
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
235
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
236 if hgutil.safehasattr(registrar, 'configitem'):
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
237 configitem = registrar.configitem(configtable)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
238 else:
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
239 def configitem(*args, **kwargs):
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
240 pass
1406
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
241 except (ImportError, AttributeError):
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
242 # registrar.templatekeyword isn't available = loading by old hg
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
243
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
244 templatekeyword = compathacks._funcregistrarbase()
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
245 templatekeyword._docformat = ":%s: %s"
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
246
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
247 # minimum copy from templatekw.loadkeyword
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
248 def loadkeyword(registrarobj):
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
249 from mercurial import templatekw
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
250 for name, func in registrarobj._table.iteritems():
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
251 templatekw.keywords[name] = func
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
252
1538
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
253 def configitem(*args, **kwargs):
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
254 # no-op so we can put config items at the top level instead of
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
255 # deeply nested
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
256 pass
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
257
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
258 if not hgutil.safehasattr(configitem, 'dynamicdefault'):
1540
c0fc42713ecb config: don't use the config registrar on hg that lacks dynamicdefault
Augie Fackler <raf@durin42.com>
parents: 1538
diff changeset
259 # hg 4.3 lacks support for dynamicdefault in a way that means we
c0fc42713ecb config: don't use the config registrar on hg that lacks dynamicdefault
Augie Fackler <raf@durin42.com>
parents: 1538
diff changeset
260 # have to not use the config registrar at all.
c0fc42713ecb config: don't use the config registrar on hg that lacks dynamicdefault
Augie Fackler <raf@durin42.com>
parents: 1538
diff changeset
261 def configitem(*args, **kwargs):
c0fc42713ecb config: don't use the config registrar on hg that lacks dynamicdefault
Augie Fackler <raf@durin42.com>
parents: 1538
diff changeset
262 pass
1538
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
263 configitem.dynamicdefault = None
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
264
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
265 # real default is 'svnexternals'. Can also be 'subrepos' or
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
266 # 'ignore'. Defines how to handle svn:externals.
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
267 configitem('hgsubversion', 'externals', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
268
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
269 # If true, use diff+patch instead of svn native replay RPC.
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
270 configitem('hgsubversion', 'stupid', default=False)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
271
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
272 # Allows configuring extra of svn+$SCHEME tunnel protocols
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
273 configitem('hgsubversion', 'tunnels', default=list)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
274 # If true, monkeypatch revset parser to allow r123 to map to
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
275 # Subversion revision 123.
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
276 configitem('hgsubversion', 'nativerevs', default=False)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
277
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
278 # Auth config for the Subversion backend
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
279 configitem('hgsubversion', 'username', default='')
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
280 configitem('hgsubversion', 'password', default='')
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
281 # The default value of the empty list means to use a default set of
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
282 # password stores. The specific ones that will be consulted depend on
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
283 # the compile-time options of your Subversion libraries.
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
284 configitem('hgsubversion', 'password_stores', default=list)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
285
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
286 # real default is None
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
287 configitem('hgsubversion', 'revmapimpl', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
288 # real default is 'auto'
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
289 configitem('hgsubversion', 'layout', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
290
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
291 # real default is True
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
292 configitem('hgsubversion', 'defaultauthors', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
293 # real default is False
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
294 configitem('hgsubversion', 'caseignoreauthors', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
295 # real default is None
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
296 configitem('hgsubversion', 'mapauthorscmd', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
297 # Defaults to the UUID identifying the source svn repo.
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
298 configitem('hgsubversion', 'defaulthost', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
299 # real default is True
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
300 configitem('hgsubversion', 'usebranchnames', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
301 # real default is ''
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
302 configitem('hgsubversion', 'defaultmessage', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
303 # real default is ''
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
304 configitem('hgsubversion', 'branch', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
305 # real default is ['tags']
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
306 configitem('hgsubversion', 'taglocations', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
307 # real default is 'trunk'
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
308 configitem('hgsubversion', 'trunkdir', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
309 # real default is ''
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
310 configitem('hgsubversion', 'infix', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
311 # real default is ''
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
312 configitem('hgsubversion', 'unsafeskip', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
313 # real default is ['tags']
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
314 configitem('hgsubversion', 'tagpaths', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
315 # real default is 'branches'
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
316 configitem('hgsubversion', 'branchdir', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
317 # real default is 200
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
318 configitem('hgsubversion', 'filestoresize', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
319 # Typically unset, custom location of map files typically stored inside .hg
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
320 configitem('hgsubversion', 'filemap', default=None)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
321 configitem('hgsubversion', 'branchmap', default=None)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
322 configitem('hgsubversion', 'authormap', default=None)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
323 configitem('hgsubversion', 'tagmap', default=None)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
324 # real default is False
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
325 configitem('hgsubversion', 'failoninvalidreplayfile',
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
326 default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
327 # real default is 0
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
328 configitem('hgsubversion', 'startrev', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
329 # extra pragmas to feed to sqlite revmap implementation
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
330 configitem('hgsubversion', 'sqlitepragmas', default=list)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
331 # real default is False
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
332 configitem('hgsubversion', 'failonmissing', default=configitem.dynamicdefault)
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
333
b0eca4d96a53 hgsubversion: cope with configitem registration soft-required by hg 4.4
Augie Fackler <raf@durin42.com>
parents: 1531
diff changeset
334
1403
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
335 def _templatehelper(ctx, kw):
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
336 '''
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
337 Helper function for displaying information about converted changesets.
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
338 '''
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
339 convertinfo = util.getsvnrev(ctx, '')
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
340
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
341 if not convertinfo or not convertinfo.startswith('svn:'):
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
342 return ''
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
343
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
344 if kw == 'svnuuid':
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
345 return convertinfo[4:40]
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
346 elif kw == 'svnpath':
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
347 return convertinfo[40:].rsplit('@', 1)[0]
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
348 elif kw == 'svnrev':
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
349 return convertinfo[40:].rsplit('@', 1)[-1]
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
350 else:
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
351 raise hgutil.Abort('unrecognized hgsubversion keyword %s' % kw)
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
352
1406
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
353 @templatekeyword('svnrev')
1403
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
354 def svnrevkw(**args):
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
355 """:svnrev: String. Converted subversion revision number."""
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
356 return _templatehelper(args['ctx'], 'svnrev')
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
357
1406
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
358 @templatekeyword('svnpath')
1403
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
359 def svnpathkw(**args):
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
360 """:svnpath: String. Converted subversion revision project path."""
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
361 return _templatehelper(args['ctx'], 'svnpath')
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
362
1406
ae4bdba90e7b templatekw: use decorator to register keywords
Sean Farley <sean@farley.io>
parents: 1403
diff changeset
363 @templatekeyword('svnuuid')
1403
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
364 def svnuuidkw(**args):
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
365 """:svnuuid: String. Converted subversion revision repository identifier."""
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
366 return _templatehelper(args['ctx'], 'svnuuid')
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
367
1479
f9e8c7662f8d templatekeywords: add missing loadkeyword() call
Augie Fackler <raf@durin42.com>
parents: 1408
diff changeset
368 loadkeyword(templatekeyword)
f9e8c7662f8d templatekeywords: add missing loadkeyword() call
Augie Fackler <raf@durin42.com>
parents: 1408
diff changeset
369
1403
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
370 def listsvnkeys(repo):
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
371 keys = {}
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
372 repo = repo.local()
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
373 metadir = os.path.join(repo.path, 'svn')
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
374
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
375 if util.subversionmetaexists(repo.path):
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
376 w = repo.wlock()
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
377 try:
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
378 for key in util.pushkeyfiles:
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
379 fullpath = os.path.join(metadir, key)
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
380 if os.path.isfile(fullpath):
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
381 data = open(fullpath).read()
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
382
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
383 # Some of the files could be large, but also quite compressible
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
384 keys[key] = base85.b85encode(zlib.compress(data))
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
385 finally:
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
386 w.release()
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
387
2f98d1e85c23 templatekw: move to __init__ to prepare for newer mercurial
Sean Farley <sean@farley.io>
parents: 1377
diff changeset
388 return keys