Mercurial > hgsubversion
annotate wrappers.py @ 284:f8f9a2993705
Implement parseurl support (#revision in repository urls)
Note: Normally when using parseurl, hg clone will treat the revision after # as
if it was passed in as --rev, treats that rev as a head and won't clone beyond
that. This wasn't implemented here, hence all the TODO's in the comments.
All we do is use the checkout parameter where appropriate to update the wc to
the selected revision.
author | Martijn Pieters <mj@zopatista.com> |
---|---|
date | Mon, 27 Apr 2009 09:39:39 -0500 |
parents | 521d9c1bb11d |
children | 1d48d9a34c19 |
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 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
17 import hg_delta_editor |
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 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
22 def parent(orig, ui, repo, *args, **opts): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
23 """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
|
24 """ |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
25 if not opts.get('svn', False): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
26 return orig(ui, repo, *args, **opts) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
27 hge = hg_delta_editor.HgChangeReceiver(repo=repo) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
28 svn_commit_hashes = dict(zip(hge.revmap.itervalues(), |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
29 hge.revmap.iterkeys())) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
30 ha = cmdutil.parentrev(ui, repo, hge, svn_commit_hashes) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
31 if ha.node() == node.nullid: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
32 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
|
33 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
|
34 displayer.show(ha) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
35 return 0 |
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 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
38 def outgoing(orig, ui, repo, dest=None, *args, **opts): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
39 """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
|
40 """ |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
41 svnurl = repo.ui.expandpath(dest or 'default-push', dest or 'default') |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
42 if not (cmdutil.issvnurl(svnurl) or opts.get('svn', False)): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
43 return orig(ui, repo, dest, *args, **opts) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
44 |
284
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
283
diff
changeset
|
45 # split off #rev; TODO implement --revision/#rev support |
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
283
diff
changeset
|
46 svnurl, revs, checkout = hg.parseurl(svnurl, opts.get('rev')) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
47 hge = hg_delta_editor.HgChangeReceiver(repo=repo) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
48 svn_commit_hashes = dict(zip(hge.revmap.itervalues(), |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
49 hge.revmap.iterkeys())) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
50 o_r = util.outgoing_revisions(ui, repo, hge, svn_commit_hashes, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
51 repo.parents()[0].node()) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
52 if not (o_r and len(o_r)): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
53 ui.status('no changes found\n') |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
54 return 0 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
55 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
|
56 for node in reversed(o_r): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
57 displayer.show(repo[node]) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
58 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
59 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
60 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
|
61 """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
|
62 """ |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
63 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
|
64 return orig(ui, repo, *args, **opts) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
65 svn_commit_hashes = {} |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
66 hge = hg_delta_editor.HgChangeReceiver(repo=repo) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
67 svn_commit_hashes = dict(zip(hge.revmap.itervalues(), |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
68 hge.revmap.iterkeys())) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
69 if not opts.get('rev', None): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
70 parent = repo.parents()[0] |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
71 o_r = util.outgoing_revisions(ui, repo, hge, svn_commit_hashes, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
72 parent.node()) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
73 if o_r: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
74 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
|
75 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
|
76 node1, node2 = hgcmdutil.revpair(repo, opts['rev']) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
77 baserev, _junk = svn_commit_hashes.get(node1, (-1, 'junk', )) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
78 newrev, _junk = svn_commit_hashes.get(node2, (-1, 'junk', )) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
79 it = patch.diff(repo, node1, node2, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
80 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
|
81 'show_function': False, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
82 'ignore_all_space': False, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
83 'ignore_space_change': False, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
84 'ignore_blank_lines': False, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
85 'unified': True, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
86 'text': False, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
87 })) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
88 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
|
89 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
90 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
91 def push(orig, ui, repo, dest=None, *args, **opts): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
92 """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
|
93 """ |
267
f000b2392fc2
Push status messages, remove svn flag from opts before passing on
Luke Opperman <luke@loppear.com>
parents:
266
diff
changeset
|
94 opts.pop('svn', None) # unused in this case |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
95 svnurl = repo.ui.expandpath(dest or 'default-push', dest or 'default') |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
96 if not cmdutil.issvnurl(svnurl): |
260
87dc4d0dd048
Forgot some return statements.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
97 return orig(ui, repo, dest=dest, *args, **opts) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
98 old_encoding = util.swap_out_encoding() |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
99 hge = hg_delta_editor.HgChangeReceiver(repo=repo) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
100 svnurl = util.normalize_url(svnurl) |
284
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
283
diff
changeset
|
101 # split of #rev; TODO: implement --rev/#rev support |
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
283
diff
changeset
|
102 svnurl, revs, checkout = hg.parseurl(svnurl, opts.get('rev')) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
103 if svnurl != hge.url: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
104 raise hgutil.Abort('wrong subversion url!') |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
105 svn_commit_hashes = dict(zip(hge.revmap.itervalues(), |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
106 hge.revmap.iterkeys())) |
265
9f0738587f94
Re-re-refix username support, add a comment so maybe I remember this time.
Augie Fackler <durin42@gmail.com>
parents:
264
diff
changeset
|
107 user, passwd = util.getuserpass(opts) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
108 # Strategy: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
109 # 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
|
110 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
|
111 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
|
112 return 1 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
113 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
|
114 ui.status('searching for changes\n') |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
115 outgoing = util.outgoing_revisions(ui, repo, hge, svn_commit_hashes, workingrev.node()) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
116 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
|
117 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
|
118 return 0 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
119 while outgoing: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
120 oldest = outgoing.pop(-1) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
121 old_ctx = repo[oldest] |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
122 if len(old_ctx.parents()) != 1: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
123 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
|
124 'implementation.\n') |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
125 return 1 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
126 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
|
127 old_children = repo[base_n].children() |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
128 svnbranch = repo[base_n].branch() |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
129 oldtip = base_n |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
130 samebranchchildren = [c for c in repo[oldtip].children() if c.branch() == svnbranch |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
131 and c.node() in svn_commit_hashes] |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
132 while samebranchchildren: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
133 oldtip = samebranchchildren[0].node() |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
134 samebranchchildren = [c for c in repo[oldtip].children() if c.branch() == svnbranch |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
135 and c.node() in svn_commit_hashes] |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
136 # 2. Commit oldest revision that needs to be pushed |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
137 base_revision = svn_commit_hashes[base_n][0] |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
138 try: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
139 cmdutil.commit_from_rev(ui, repo, old_ctx, hge, svnurl, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
140 base_revision, user, passwd) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
141 except cmdutil.NoFilesException: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
142 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
|
143 old_ctx) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
144 return 1 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
145 # 3. Fetch revisions from svn |
262
3b3627611468
Fix pushing after 141513b.
Augie Fackler <durin42@gmail.com>
parents:
261
diff
changeset
|
146 # TODO this probably should pass in the source explicitly |
3b3627611468
Fix pushing after 141513b.
Augie Fackler <durin42@gmail.com>
parents:
261
diff
changeset
|
147 r = pull(None, ui, repo, svn=True, stupid=opts.get('svn_stupid', False), |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
148 username=user, password=passwd) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
149 assert not r or r == 0 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
150 # 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
|
151 repo = hg.repository(ui, hge.path) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
152 oldtipctx = repo[oldtip] |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
153 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
|
154 and c.branch() == oldtipctx.branch()] |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
155 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
|
156 replacement = replacement[0] |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
157 # 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
|
158 heads = repo.heads(old_ctx.node()) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
159 for needs_transplant in heads: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
160 def extrafn(ctx, extra): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
161 if ctx.node() == oldest: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
162 return |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
163 extra['branch'] = ctx.branch() |
264
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
164 rebase(hgrebase.rebase, ui, repo, svn=True, svnextrafn=extrafn, |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
165 svnsourcerev=needs_transplant, **opts) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
166 repo = hg.repository(ui, hge.path) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
167 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
|
168 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
|
169 if rebasesrc in outgoing: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
170 while rebasesrc in outgoing: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
171 rebsrcindex = outgoing.index(rebasesrc) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
172 outgoing = (outgoing[0:rebsrcindex] + |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
173 [child.node(), ] + outgoing[rebsrcindex+1:]) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
174 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
|
175 if children: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
176 child = children[0] |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
177 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
|
178 hge = hg_delta_editor.HgChangeReceiver(hge.path, ui_=ui) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
179 svn_commit_hashes = dict(zip(hge.revmap.itervalues(), hge.revmap.iterkeys())) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
180 util.swap_out_encoding(old_encoding) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
181 return 0 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
182 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
183 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
184 def clone(orig, ui, source, dest=None, *args, **opts): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
185 '''clone Subversion repository to a local Mercurial repository. |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
186 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
187 If no destination directory name is specified, it defaults to the |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
188 basename of the source plus "-hg". |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
189 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
190 You can specify multiple paths for the location of tags using comma |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
191 separated values. |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
192 ''' |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
193 svnurl = ui.expandpath(source) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
194 if not cmdutil.issvnurl(svnurl): |
260
87dc4d0dd048
Forgot some return statements.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
195 return orig(ui, source=source, dest=dest, *args, **opts) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
196 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
197 if not dest: |
284
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
283
diff
changeset
|
198 dest = hg.defaultdest(hg.parseurl(source)[0]) + '-hg' |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
199 ui.status("Assuming destination %s\n" % dest) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
200 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
201 if os.path.exists(dest): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
202 raise hgutil.Abort("destination '%s' already exists" % dest) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
203 url = util.normalize_url(svnurl) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
204 res = -1 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
205 try: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
206 try: |
261
141513b5173b
Stop breaking hg pull <path>.
Augie Fackler <durin42@gmail.com>
parents:
260
diff
changeset
|
207 res = pull(None, ui, None, source=url, svn=None, |
141513b5173b
Stop breaking hg pull <path>.
Augie Fackler <durin42@gmail.com>
parents:
260
diff
changeset
|
208 svn_stupid=opts.pop('svn_stupid', False), |
141513b5173b
Stop breaking hg pull <path>.
Augie Fackler <durin42@gmail.com>
parents:
260
diff
changeset
|
209 create_new_dest=dest, **opts) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
210 except core.SubversionException, e: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
211 if e.apr_err == core.SVN_ERR_RA_SERF_SSL_CERT_UNTRUSTED: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
212 raise hgutil.Abort('It appears svn does not trust the ssl cert for this site.\n' |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
213 'Please try running svn ls on that url first.') |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
214 raise |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
215 finally: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
216 if os.path.exists(dest): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
217 repo = hg.repository(ui, dest) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
218 fp = repo.opener("hgrc", "w", text=True) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
219 fp.write("[paths]\n") |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
220 # percent needs to be escaped for ConfigParser |
276
b45bae16be32
clone: Fix url-escaping for new config parser
Augie Fackler <durin42@gmail.com>
parents:
271
diff
changeset
|
221 fp.write("default = %(url)s\nsvn = %(url)s\n" % {'url': svnurl}) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
222 fp.close() |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
223 if (res is None or res == 0) and not opts.get('noupdate', False): |
284
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
283
diff
changeset
|
224 # Split off #rev |
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
283
diff
changeset
|
225 url, revs, checkout = hg.parseurl(svnurl) |
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
283
diff
changeset
|
226 for test in (checkout, 'default', 'tip'): |
278
60acc38eac96
clone: prefer tip of default to overall tip when updating
Martijn Pieters <mj@zopatista.com>
parents:
276
diff
changeset
|
227 try: |
60acc38eac96
clone: prefer tip of default to overall tip when updating
Martijn Pieters <mj@zopatista.com>
parents:
276
diff
changeset
|
228 uprev = repo.lookup(test) |
60acc38eac96
clone: prefer tip of default to overall tip when updating
Martijn Pieters <mj@zopatista.com>
parents:
276
diff
changeset
|
229 break |
60acc38eac96
clone: prefer tip of default to overall tip when updating
Martijn Pieters <mj@zopatista.com>
parents:
276
diff
changeset
|
230 except: |
60acc38eac96
clone: prefer tip of default to overall tip when updating
Martijn Pieters <mj@zopatista.com>
parents:
276
diff
changeset
|
231 continue |
60acc38eac96
clone: prefer tip of default to overall tip when updating
Martijn Pieters <mj@zopatista.com>
parents:
276
diff
changeset
|
232 commands.update(ui, repo, uprev) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
233 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
234 return res |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
235 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
236 |
261
141513b5173b
Stop breaking hg pull <path>.
Augie Fackler <durin42@gmail.com>
parents:
260
diff
changeset
|
237 def pull(orig, ui, repo, source="default", *args, **opts): |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
238 """pull new revisions from Subversion |
261
141513b5173b
Stop breaking hg pull <path>.
Augie Fackler <durin42@gmail.com>
parents:
260
diff
changeset
|
239 |
141513b5173b
Stop breaking hg pull <path>.
Augie Fackler <durin42@gmail.com>
parents:
260
diff
changeset
|
240 Also takes svn, svn_stupid, and create_new_dest kwargs. |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
241 """ |
261
141513b5173b
Stop breaking hg pull <path>.
Augie Fackler <durin42@gmail.com>
parents:
260
diff
changeset
|
242 svn = opts.pop('svn', None) |
141513b5173b
Stop breaking hg pull <path>.
Augie Fackler <durin42@gmail.com>
parents:
260
diff
changeset
|
243 svn_stupid = opts.pop('svn_stupid', False) |
141513b5173b
Stop breaking hg pull <path>.
Augie Fackler <durin42@gmail.com>
parents:
260
diff
changeset
|
244 create_new_dest = opts.pop('create_new_dest', False) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
245 url = ((repo and repo.ui) or ui).expandpath(source) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
246 if not (cmdutil.issvnurl(url) or svn or create_new_dest): |
260
87dc4d0dd048
Forgot some return statements.
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
247 return orig(ui, repo, source=source, *args, **opts) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
248 svn_url = url |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
249 svn_url = util.normalize_url(svn_url) |
284
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
283
diff
changeset
|
250 # Split off #rev; TODO: implement --rev/#rev support limiting the pulled/cloned revisions |
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
283
diff
changeset
|
251 svn_url, revs, checkout = hg.parseurl(svn_url, opts.get('rev')) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
252 old_encoding = util.swap_out_encoding() |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
253 # TODO implement skipto support |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
254 skipto_rev = 0 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
255 have_replay = not svn_stupid |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
256 if have_replay and not callable( |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
257 delta.svn_txdelta_apply(None, None, None)[0]): #pragma: no cover |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
258 ui.status('You are using old Subversion SWIG bindings. Replay will not' |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
259 ' work until you upgrade to 1.5.0 or newer. Falling back to' |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
260 ' a slower method that may be buggier. Please upgrade, or' |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
261 ' contribute a patch to use the ctypes bindings instead' |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
262 ' of SWIG.\n') |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
263 have_replay = False |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
264 initializing_repo = False |
265
9f0738587f94
Re-re-refix username support, add a comment so maybe I remember this time.
Augie Fackler <durin42@gmail.com>
parents:
264
diff
changeset
|
265 user, passwd = util.getuserpass(opts) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
266 svn = svnwrap.SubversionRepo(svn_url, user, passwd) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
267 author_host = "@%s" % svn.uuid |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
268 tag_locations = ['tags', ] |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
269 authors = opts.pop('svn_authors', None) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
270 filemap = opts.pop('svn_filemap', None) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
271 if repo: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
272 hg_editor = hg_delta_editor.HgChangeReceiver(repo=repo, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
273 subdir=svn.subdir, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
274 author_host=author_host, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
275 tag_locations=tag_locations, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
276 authors=authors, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
277 filemap=filemap) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
278 else: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
279 hg_editor = hg_delta_editor.HgChangeReceiver(ui_=ui, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
280 path=create_new_dest, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
281 subdir=svn.subdir, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
282 author_host=author_host, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
283 tag_locations=tag_locations, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
284 authors=authors, |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
285 filemap=filemap) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
286 if os.path.exists(hg_editor.uuid_file): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
287 uuid = open(hg_editor.uuid_file).read() |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
288 assert uuid == svn.uuid |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
289 start = hg_editor.last_known_revision() |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
290 else: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
291 open(hg_editor.uuid_file, 'w').write(svn.uuid) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
292 open(hg_editor.svn_url_file, 'w').write(svn_url) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
293 initializing_repo = True |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
294 start = skipto_rev |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
295 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
296 if initializing_repo and start > 0: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
297 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
|
298 'remains unimplemented.') |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
299 |
283
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
300 revisions = 0 |
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
301 if not initializing_repo: |
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
302 oldheads = len(repo.changelog.heads()) |
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
303 |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
304 # start converting revisions |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
305 for r in svn.revisions(start=start): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
306 valid = True |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
307 hg_editor.update_branch_tag_map_for_rev(r) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
308 for p in r.paths: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
309 if hg_editor._is_path_valid(p): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
310 valid = True |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
311 break |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
312 if valid: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
313 # got a 502? Try more than once! |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
314 tries = 0 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
315 converted = False |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
316 while not converted: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
317 try: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
318 util.describe_revision(ui, r) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
319 if have_replay: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
320 try: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
321 cmdutil.replay_convert_rev(hg_editor, svn, r) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
322 except svnwrap.SubversionRepoCanNotReplay, e: #pragma: no cover |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
323 ui.status('%s\n' % e.message) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
324 stupidmod.print_your_svn_is_old_message(ui) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
325 have_replay = False |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
326 stupidmod.svn_server_pull_rev(ui, svn, hg_editor, r) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
327 else: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
328 stupidmod.svn_server_pull_rev(ui, svn, hg_editor, r) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
329 converted = True |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
330 except core.SubversionException, e: #pragma: no cover |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
331 if (e.apr_err == core.SVN_ERR_RA_DAV_REQUEST_FAILED |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
332 and '502' in str(e) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
333 and tries < 3): |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
334 tries += 1 |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
335 ui.status('Got a 502, retrying (%s)\n' % tries) |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
336 else: |
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
337 raise hgutil.Abort(*e.args) |
283
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
338 revisions += 1 |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
339 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
|
340 |
283
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
341 if revisions == 0: |
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
342 ui.status(i18n._("no changes found\n")) |
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
343 return |
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
344 else: |
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
345 ui.status("added %d svn revisions\n" % revisions) |
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
346 if not initializing_repo: |
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
347 newheads = len(repo.changelog.heads()) |
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
348 # postincoming needs to know if heads were added or removed |
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
349 # calculation based on mercurial.localrepo.addchangegroup |
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
350 # 0 means no changes, 1 no new heads, > 1 new heads, < 0 heads removed |
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
351 modheads = newheads - oldheads + (newheads < oldheads and -1 or 1) |
284
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
283
diff
changeset
|
352 commands.postincoming(ui, repo, modheads, opts.get('update'), checkout) |
283
521d9c1bb11d
Implement -u/--update support when pulling.
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
353 |
264
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
354 |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
355 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
|
356 """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
|
357 |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
358 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
|
359 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
|
360 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
|
361 '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
|
362 |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
363 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
|
364 """ |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
365 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
|
366 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
|
367 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
|
368 """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
|
369 """ |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
370 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
|
371 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
|
372 sourcerev = opts.get('svnsourcerev', repo.parents()[0].node()) |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
373 hge = hg_delta_editor.HgChangeReceiver(repo=repo) |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
374 svn_commit_hashes = dict(zip(hge.revmap.itervalues(), |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
375 hge.revmap.iterkeys())) |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
376 o_r = util.outgoing_revisions(ui, repo, hge, svn_commit_hashes, sourcerev=sourcerev) |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
377 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
|
378 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
|
379 return 0 |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
380 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
|
381 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
|
382 return 0 |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
383 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
|
384 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
|
385 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
|
386 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
|
387 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
|
388 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
|
389 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
|
390 n = c.node() |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
391 if (n in svn_commit_hashes and |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
392 svn_commit_hashes[n][1] == svn_commit_hashes[p_n][1]): |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
393 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
|
394 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
|
395 break |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
396 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
|
397 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
|
398 return 0 |
112d57bb736e
rebase: moved to wrappers, now a wrapper around rebase triggered with --svn.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
399 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
|
400 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
|
401 extrafn=extrafn) |