annotate hgsubversion/wrappers.py @ 416:cd6317fe70be

invert the svnmeta/editor relationship
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Thu, 11 Jun 2009 18:49:52 +0200
parents b17b2969861c
children 92beeefeaf93
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 import os
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2
264
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
3 from hgext import rebase as hgrebase
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
4
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5 from mercurial import cmdutil as hgcmdutil
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6 from mercurial import commands
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
7 from mercurial import patch
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
8 from mercurial import hg
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9 from mercurial import util as hgutil
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
10 from mercurial import node
283
521d9c1bb11d Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents: 278
diff changeset
11 from mercurial import i18n
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
13 from svn import core
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14 from svn import delta
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
15
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
16 import cmdutil
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
17 import svnmeta
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
18 import stupid as stupidmod
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19 import svnwrap
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20 import util
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21
366
25ebdc16b05b Simplify pulling revs a bit, unify stupid/replay interfaces.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 356
diff changeset
22 pullfuns = {
25ebdc16b05b Simplify pulling revs a bit, unify stupid/replay interfaces.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 356
diff changeset
23 True: cmdutil.replay_convert_rev,
25ebdc16b05b Simplify pulling revs a bit, unify stupid/replay interfaces.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 356
diff changeset
24 False: stupidmod.convert_rev,
25ebdc16b05b Simplify pulling revs a bit, unify stupid/replay interfaces.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 356
diff changeset
25 }
25ebdc16b05b Simplify pulling revs a bit, unify stupid/replay interfaces.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 356
diff changeset
26
404
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
27 revmeta = [
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
28 ('revision', 'revnum'),
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
29 ('user', 'author'),
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
30 ('date', 'date'),
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
31 ('message', 'message'),
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
32 ]
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
33
403
37c96b78b8c0 uisetup: use a single loop/abstraction for wrapping all the commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 402
diff changeset
34 def parents(orig, ui, repo, *args, **opts):
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
35 """show Mercurial & Subversion parents of the working dir or revision
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
36 """
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
37 if not opts.get('svn', False):
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
38 return orig(ui, repo, *args, **opts)
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
39 meta = svnmeta.SVNMeta(repo)
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
40 hashes = meta.revmap.hashes()
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
41 ha = cmdutil.parentrev(ui, repo, meta, hashes)
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
42 if ha.node() == node.nullid:
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
43 raise hgutil.Abort('No parent svn revision!')
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
44 displayer = hgcmdutil.show_changeset(ui, repo, opts, buffered=False)
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
45 displayer.show(ha)
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
46 return 0
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
47
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
48
404
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
49 def incoming(orig, ui, repo, source='default', **opts):
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
50 """show incoming revisions from Subversion
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
51 """
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
52
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
53 source, revs, checkout = hg.parseurl(ui.expandpath(source))
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
54 other = hg.repository(ui, source)
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
55 if 'subversion' not in other.capabilities:
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
56 return orig(ui, repo, source, **opts)
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
57
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
58 user, passwd = util.getuserpass(opts)
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
59 svn = svnwrap.SubversionRepo(other.svnurl, user, passwd)
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
60 meta = svnmeta.SVNMeta(repo)
404
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
61
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
62 ui.status('incoming changes from %s\n' % other.svnurl)
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
63 for r in svn.revisions(start=meta.revmap.seen):
404
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
64 ui.status('\n')
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
65 for label, attr in revmeta:
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
66 l1 = label + ':'
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
67 val = str(getattr(r, attr)).strip()
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
68 if not ui.verbose:
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
69 val = val.split('\n')[0]
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
70 ui.status('%s%s\n' % (l1.ljust(13), val))
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
71
28e4b47b2179 add a working incoming wrapper command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 403
diff changeset
72
347
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
73 def outgoing(repo, dest=None, heads=None, force=False):
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
74 """show changesets not found in the Subversion repository
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
75 """
347
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
76 assert dest.capable('subversion')
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
77
284
f8f9a2993705 Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents: 283
diff changeset
78 # split off #rev; TODO implement --revision/#rev support
347
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
79 svnurl, revs, checkout = hg.parseurl(dest.svnurl, heads)
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
80 meta = svnmeta.SVNMeta(repo)
406
e360558ba65f add a function to generate svn_commit_hashes
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 405
diff changeset
81 parent = repo.parents()[0].node()
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
82 hashes = meta.revmap.hashes()
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
83 return util.outgoing_revisions(repo, hashes, parent)
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
84
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
85
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
86 def diff(orig, ui, repo, *args, **opts):
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
87 """show a diff of the most recent revision against its parent from svn
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
88 """
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
89 if not opts.get('svn', False) or opts.get('change', None):
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
90 return orig(ui, repo, *args, **opts)
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
91 meta = svnmeta.SVNMeta(repo)
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
92 hashes = meta.revmap.hashes()
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
93 if not opts.get('rev', None):
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
94 parent = repo.parents()[0]
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
95 o_r = util.outgoing_revisions(repo, hashes, parent.node())
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
96 if o_r:
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
97 parent = repo[o_r[-1]].parents()[0]
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
98 opts['rev'] = ['%s:.' % node.hex(parent.node()), ]
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
99 node1, node2 = hgcmdutil.revpair(repo, opts['rev'])
406
e360558ba65f add a function to generate svn_commit_hashes
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 405
diff changeset
100 baserev, _junk = hashes.get(node1, (-1, 'junk'))
e360558ba65f add a function to generate svn_commit_hashes
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 405
diff changeset
101 newrev, _junk = hashes.get(node2, (-1, 'junk'))
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
102 it = patch.diff(repo, node1, node2,
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
103 opts=patch.diffopts(ui, opts={'git': True,
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
104 'show_function': False,
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
105 'ignore_all_space': False,
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
106 'ignore_space_change': False,
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
107 'ignore_blank_lines': False,
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
108 'unified': True,
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
109 'text': False,
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
110 }))
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
111 ui.write(cmdutil.filterdiff(''.join(it), baserev, newrev))
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
112
347
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
113 def push(repo, dest, force, revs):
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
114 """push revisions starting at a specified head back to Subversion.
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
115 """
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
116 assert not revs, 'designated revisions for push remains unimplemented.'
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
117 ui = repo.ui
347
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
118 svnurl = util.normalize_url(repo.ui.expandpath(dest.svnurl))
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
119 old_encoding = util.swap_out_encoding()
284
f8f9a2993705 Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents: 283
diff changeset
120 # split of #rev; TODO: implement --rev/#rev support
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
121 svnurl, revs, checkout = hg.parseurl(svnurl, revs)
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
122 # TODO: do credentials specified in the URL still work?
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
123 user = repo.ui.config('hgsubversion', 'username')
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 329
diff changeset
124 passwd = repo.ui.config('hgsubversion', 'password')
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
125 svn = svnwrap.SubversionRepo(svnurl, user, passwd)
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
126 meta = svnmeta.SVNMeta(repo, svn.uuid)
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
127
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
128 # Strategy:
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
129 # 1. Find all outgoing commits from this head
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
130 if len(repo.parents()) != 1:
271
5278817fe8a1 Add newlines to ui.status calls where needed
Daniel Tang <dytang@cs.purdue.edu>
parents: 269
diff changeset
131 ui.status('Cowardly refusing to push branch merge\n')
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
132 return 1
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
133 workingrev = repo.parents()[0]
267
f000b2392fc2 Push status messages, remove svn flag from opts before passing on
Luke Opperman <luke@loppear.com>
parents: 266
diff changeset
134 ui.status('searching for changes\n')
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
135 hashes = meta.revmap.hashes()
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
136 outgoing = util.outgoing_revisions(repo, hashes, workingrev.node())
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
137 if not (outgoing and len(outgoing)):
267
f000b2392fc2 Push status messages, remove svn flag from opts before passing on
Luke Opperman <luke@loppear.com>
parents: 266
diff changeset
138 ui.status('no changes found\n')
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
139 return 0
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
140 while outgoing:
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
141 oldest = outgoing.pop(-1)
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
142 old_ctx = repo[oldest]
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
143 if len(old_ctx.parents()) != 1:
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
144 ui.status('Found a branch merge, this needs discussion and '
271
5278817fe8a1 Add newlines to ui.status calls where needed
Daniel Tang <dytang@cs.purdue.edu>
parents: 269
diff changeset
145 'implementation.\n')
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
146 return 1
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
147 base_n = old_ctx.parents()[0].node()
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
148 old_children = repo[base_n].children()
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
149 svnbranch = repo[base_n].branch()
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
150 oldtip = base_n
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
151 samebranchchildren = [c for c in repo[oldtip].children() if c.branch() == svnbranch
406
e360558ba65f add a function to generate svn_commit_hashes
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 405
diff changeset
152 and c.node() in hashes]
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
153 while samebranchchildren:
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
154 oldtip = samebranchchildren[0].node()
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
155 samebranchchildren = [c for c in repo[oldtip].children() if c.branch() == svnbranch
406
e360558ba65f add a function to generate svn_commit_hashes
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 405
diff changeset
156 and c.node() in hashes]
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
157 # 2. Commit oldest revision that needs to be pushed
406
e360558ba65f add a function to generate svn_commit_hashes
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 405
diff changeset
158 base_revision = hashes[base_n][0]
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
159 try:
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
160 cmdutil.commit_from_rev(ui, repo, old_ctx, meta, svnurl,
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
161 base_revision, user, passwd)
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
162 except cmdutil.NoFilesException:
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
163 ui.warn("Could not push revision %s because it had no changes in svn.\n" %
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
164 old_ctx)
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
165 return 1
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
166 # 3. Fetch revisions from svn
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
167 # TODO: this probably should pass in the source explicitly - rev too?
347
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
168 r = repo.pull(dest, force=force)
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
169 assert not r or r == 0
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
170 # 4. Find the new head of the target branch
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
171 oldtipctx = repo[oldtip]
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
172 replacement = [c for c in oldtipctx.children() if c not in old_children
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
173 and c.branch() == oldtipctx.branch()]
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
174 assert len(replacement) == 1, 'Replacement node came back as: %r' % replacement
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
175 replacement = replacement[0]
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
176 # 5. Rebase all children of the currently-pushing rev to the new branch
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
177 heads = repo.heads(old_ctx.node())
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
178 for needs_transplant in heads:
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
179 def extrafn(ctx, extra):
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
180 if ctx.node() == oldest:
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
181 return
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
182 extra['branch'] = ctx.branch()
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
183 # TODO: can we avoid calling our own rebase wrapper here?
264
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
184 rebase(hgrebase.rebase, ui, repo, svn=True, svnextrafn=extrafn,
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
185 svnsourcerev=needs_transplant)
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
186 repo = hg.repository(ui, meta.path)
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
187 for child in repo[replacement.node()].children():
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
188 rebasesrc = node.bin(child.extra().get('rebase_source', node.hex(node.nullid)))
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
189 if rebasesrc in outgoing:
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
190 while rebasesrc in outgoing:
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
191 rebsrcindex = outgoing.index(rebasesrc)
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
192 outgoing = (outgoing[0:rebsrcindex] +
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
193 [child.node(), ] + outgoing[rebsrcindex+1:])
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
194 children = [c for c in child.children() if c.branch() == child.branch()]
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
195 if children:
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
196 child = children[0]
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
197 rebasesrc = node.bin(child.extra().get('rebase_source', node.hex(node.nullid)))
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
198 # TODO: stop constantly creating the SVNMeta instances.
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
199 meta = svnmeta.SVNMeta(meta.repo, svn.uuid)
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
200 hashes = meta.revmap.hashes()
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
201 util.swap_out_encoding(old_encoding)
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
202 return 0
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
203
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
204
347
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
205 def pull(repo, source, heads=[], force=False):
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
206 """pull new revisions from Subversion"""
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
207 assert source.capable('subversion')
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
208 svn_url = source.svnurl
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
209
342
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 341
diff changeset
210 # Split off #rev
344
4dfab1b8b7be Mention what failed when given a non-numeric revision to clone/pull.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 342
diff changeset
211 svn_url, heads, checkout = hg.parseurl(svn_url, heads)
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
212 old_encoding = util.swap_out_encoding()
341
cfbd0e563af9 wrappers: remove unused clone() function.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 337
diff changeset
213
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
214 # TODO implement skipto support
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
215 skipto_rev = 0
342
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 341
diff changeset
216 try:
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 341
diff changeset
217 stopat_rev = int(checkout or 0)
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 341
diff changeset
218 except ValueError:
344
4dfab1b8b7be Mention what failed when given a non-numeric revision to clone/pull.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 342
diff changeset
219 raise hgutil.Abort('unrecognised Subversion revision %s: '
4dfab1b8b7be Mention what failed when given a non-numeric revision to clone/pull.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 342
diff changeset
220 'only numbers work.' % checkout)
342
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 341
diff changeset
221
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
222 have_replay = not repo.ui.configbool('hgsubversion', 'stupid')
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
223 if have_replay and not callable(
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
224 delta.svn_txdelta_apply(None, None, None)[0]): #pragma: no cover
347
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
225 repo.ui.status('You are using old Subversion SWIG bindings. Replay '
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
226 'will not work until you upgrade to 1.5.0 or newer. '
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
227 'Falling back to a slower method that may be buggier. '
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
228 'Please upgrade, or contribute a patch to use the '
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
229 'ctypes bindings instead of SWIG.\n')
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
230 have_replay = False
347
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
231 elif not have_replay:
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
232 repo.ui.note('fetching stupidly...\n')
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
233
341
cfbd0e563af9 wrappers: remove unused clone() function.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 337
diff changeset
234 # TODO: do credentials specified in the URL still work?
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
235 user = repo.ui.config('hgsubversion', 'username')
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 329
diff changeset
236 passwd = repo.ui.config('hgsubversion', 'password')
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
237 svn = svnwrap.SubversionRepo(svn_url, user, passwd)
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
238 meta = svnmeta.SVNMeta(repo, svn.uuid, svn.subdir)
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
239
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
240 start = max(meta.revmap.seen, skipto_rev)
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
241 initializing_repo = meta.revmap.seen <= 0
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
242 ui = repo.ui
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
243
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
244 if initializing_repo and start > 0:
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
245 raise hgutil.Abort('Revision skipping at repository initialization '
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
246 'remains unimplemented.')
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
247
283
521d9c1bb11d Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents: 278
diff changeset
248 revisions = 0
342
76c833526fbc Use fallbacks in the wrappers for Subversion support, instead of prefixes.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 341
diff changeset
249 try:
390
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
250 try:
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
251 # start converting revisions
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
252 for r in svn.revisions(start=start, stop=stopat_rev):
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
253 if (r.author is None and
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
254 r.message == 'This is an empty revision for padding.'):
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
255 continue
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
256 tbdelta = meta.update_branch_tag_map_for_rev(r)
390
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
257 # got a 502? Try more than once!
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
258 tries = 0
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
259 converted = False
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
260 while not converted:
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
261 try:
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
262 util.describe_revision(ui, r)
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
263 pullfuns[have_replay](ui, meta, svn, r, tbdelta)
390
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
264 converted = True
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
265 except svnwrap.SubversionRepoCanNotReplay, e: #pragma: no cover
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
266 ui.status('%s\n' % e.message)
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
267 stupidmod.print_your_svn_is_old_message(ui)
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
268 have_replay = False
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
269 except core.SubversionException, e: #pragma: no cover
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
270 if (e.apr_err == core.SVN_ERR_RA_DAV_REQUEST_FAILED
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
271 and '502' in str(e)
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
272 and tries < 3):
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
273 tries += 1
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
274 ui.status('Got a 502, retrying (%s)\n' % tries)
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
275 else:
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
276 raise hgutil.Abort(*e.args)
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
277 revisions += 1
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
278 except KeyboardInterrupt:
afe93f14a361 wrappers: Python 2.4 compat.
Augie Fackler <durin42@gmail.com>
parents: 367
diff changeset
279 pass
347
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
280 finally:
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
281 util.swap_out_encoding(old_encoding)
264
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
282
283
521d9c1bb11d Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents: 278
diff changeset
283 if revisions == 0:
521d9c1bb11d Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents: 278
diff changeset
284 ui.status(i18n._("no changes found\n"))
347
537de0300510 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 346
diff changeset
285 return 0
283
521d9c1bb11d Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents: 278
diff changeset
286 else:
341
cfbd0e563af9 wrappers: remove unused clone() function.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 337
diff changeset
287 ui.status("pulled %d revisions\n" % revisions)
264
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
288
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
289 def rebase(orig, ui, repo, **opts):
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
290 """rebase current unpushed revisions onto the Subversion head
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
291
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
292 This moves a line of development from making its own head to the top of
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
293 Subversion development, linearizing the changes. In order to make sure you
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
294 rebase on top of the current top of Subversion work, you should probably run
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
295 'hg svn pull' before running this.
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
296
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
297 Also looks for svnextrafn and svnsourcerev in **opts.
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
298 """
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
299 if not opts.get('svn', False):
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
300 return orig(ui, repo, **opts)
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
301 def extrafn2(ctx, extra):
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
302 """defined here so we can add things easily.
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
303 """
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
304 extra['branch'] = ctx.branch()
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
305 extrafn = opts.get('svnextrafn', extrafn2)
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
306 sourcerev = opts.get('svnsourcerev', repo.parents()[0].node())
416
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
307 meta = svnmeta.SVNMeta(repo)
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
308 hashes = meta.revmap.hashes()
cd6317fe70be invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 415
diff changeset
309 o_r = util.outgoing_revisions(repo, hashes, sourcerev=sourcerev)
264
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
310 if not o_r:
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
311 ui.status('Nothing to rebase!\n')
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
312 return 0
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
313 if len(repo[sourcerev].children()):
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
314 ui.status('Refusing to rebase non-head commit like a coward\n')
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
315 return 0
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
316 parent_rev = repo[o_r[-1]].parents()[0]
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
317 target_rev = parent_rev
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
318 p_n = parent_rev.node()
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
319 exhausted_choices = False
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
320 while target_rev.children() and not exhausted_choices:
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
321 for c in target_rev.children():
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
322 exhausted_choices = True
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
323 n = c.node()
406
e360558ba65f add a function to generate svn_commit_hashes
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 405
diff changeset
324 if (n in hashes and hashes[n][1] == hashes[p_n][1]):
264
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
325 target_rev = c
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
326 exhausted_choices = False
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
327 break
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
328 if parent_rev == target_rev:
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
329 ui.status('Already up to date!\n')
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
330 return 0
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
331 return orig(ui, repo, dest=node.hex(target_rev.node()),
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
332 base=node.hex(sourcerev),
112d57bb736e rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents: 263
diff changeset
333 extrafn=extrafn)
402
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
334
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
335
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
336 optionmap = {
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
337 'tagpaths': ('hgsubversion', 'tagpaths'),
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
338 'authors': ('hgsubversion', 'authormap'),
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
339 'filemap': ('hgsubversion', 'filemap'),
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
340 'stupid': ('hgsubversion', 'stupid'),
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
341 'defaulthost': ('hgsubversion', 'defaulthost'),
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
342 'defaultauthors': ('hgsubversion', 'defaultauthors'),
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
343 'usebranchnames': ('hgsubversion', 'usebranchnames'),
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
344 }
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
345
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
346 dontretain = { 'hgsubversion': set(['authormap', 'filemap']) }
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
347
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
348 def clone(orig, ui, source, dest=None, **opts):
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
349 """
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
350 Some of the options listed below only apply to Subversion
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
351 %(target)s. See 'hg help %(extension)s' for more information on
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
352 them as well as other ways of customising the conversion process.
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
353 """
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
354
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
355 for opt, (section, name) in optionmap.iteritems():
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
356 if opt in opts and opts[opt]:
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
357 ui.setconfig(section, name, str(opts.pop(opt)))
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
358
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
359 # this must be kept in sync with mercurial/commands.py
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
360 srcrepo, dstrepo = hg.clone(hgcmdutil.remoteui(ui, opts), source, dest,
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
361 pull=opts.get('pull'),
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
362 stream=opts.get('uncompressed'),
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
363 rev=opts.get('rev'),
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
364 update=not opts.get('noupdate'))
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
365
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
366 if dstrepo.local() and srcrepo.capable('subversion'):
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
367 fd = dstrepo.opener("hgrc", "a", text=True)
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
368 for section in set(s for s, v in optionmap.itervalues()):
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
369 config = dict(ui.configitems(section))
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
370 for name in dontretain[section]:
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
371 config.pop(name, None)
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
372
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
373 if config:
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
374 fd.write('\n[%s]\n' % section)
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
375 map(fd.write, ('%s = %s\n' % p for p in config.iteritems()))
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
376
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
377
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
378 def generic(orig, ui, repo, *args, **opts):
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
379 """
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
380 Subversion %(target)s can be used for %(command)s. See 'hg help
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
381 %(extension)s' for more on the conversion process.
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
382 """
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
383 for opt, (section, name) in optionmap.iteritems():
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
384 if opt in opts and opts[opt]:
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
385 if isinstance(repo, str):
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
386 ui.setconfig(section, name, opts.pop(opt))
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
387 else:
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
388 repo.ui.setconfig(section, name, opts.pop(opt))
d453cf1aafa3 uisetup: move clone and push/pull wrappers to wrappers module
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 390
diff changeset
389 return orig(ui, repo, *args, **opts)