Mercurial > hgsubversion
annotate utility_commands.py @ 150:58ae90a65f41
push: Improved the rebasing logic for push so that it doesn't break with
keeping branch names during rebase.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Mon, 22 Dec 2008 21:21:11 -0600 |
parents | 04800fda7af5 |
children | 1fde85a10f9e |
rev | line source |
---|---|
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
1 from mercurial import cmdutil |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
2 from mercurial import node |
64
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
3 from mercurial import util as mutil |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
4 from hgext import rebase |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
5 |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
6 import util |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
7 import hg_delta_editor |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
8 |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
9 @util.register_subcommand('url') |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
10 def print_wc_url(ui, repo, hg_repo_path, **opts): |
115
ed42f6e5705a
Clean up help text, document subcommands.
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
11 """Url of Subversion repository |
ed42f6e5705a
Clean up help text, document subcommands.
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
12 """ |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
13 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
14 ui_=ui) |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
15 ui.status(hge.url, '\n') |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
16 |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
17 |
64
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
18 @util.register_subcommand('info') |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
19 def run_svn_info(ui, repo, hg_repo_path, **opts): |
115
ed42f6e5705a
Clean up help text, document subcommands.
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
20 """Like svn info details |
ed42f6e5705a
Clean up help text, document subcommands.
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
21 """ |
64
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
22 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
23 ui_=ui) |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
24 svn_commit_hashes = dict(zip(hge.revmap.itervalues(), |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
25 hge.revmap.iterkeys())) |
99
1da7aafdd323
Refactored outgoing_revisions into util where it really belongs.
Augie Fackler <durin42@gmail.com>
parents:
95
diff
changeset
|
26 o_r = util.outgoing_revisions(ui, repo, hge, svn_commit_hashes) |
64
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
27 ha = repo.parents()[0] |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
28 if o_r: |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
29 ha = repo[o_r[-1]].parents()[0] |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
30 r, br = svn_commit_hashes[ha.node()] |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
31 if br == None: |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
32 branchpath = '/trunk' |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
33 else: |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
34 branchpath = '/branches/%s' % br |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
35 url = hge.url |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
36 if url[-1] == '/': |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
37 url = url[:-1] |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
38 url = '%s%s' % (url, branchpath) |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
39 author = '@'.join(ha.user().split('@')[:-1]) |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
40 ui.status('''URL: %(url)s |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
41 Repository Root: %(reporoot)s |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
42 Repository UUID: %(uuid)s |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
43 Revision: %(revision)s |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
44 Node Kind: directory |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
45 Last Changed Author: %(author)s |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
46 Last Changed Rev: %(revision)s |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
47 Last Changed Date: %(date)s\n''' % |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
48 {'reporoot': None, |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
49 'uuid': open(hge.uuid_file).read(), |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
50 'url': url, |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
51 'author': author, |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
52 'revision': r, |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
53 # TODO I'd like to format this to the user's local TZ if possible |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
54 'date': mutil.datestr(ha.date(), |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
55 '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)') |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
56 }) |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
57 |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
58 |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
59 @util.register_subcommand('parent') |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
60 def print_parent_revision(ui, repo, hg_repo_path, **opts): |
115
ed42f6e5705a
Clean up help text, document subcommands.
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
61 """Display hg hash and svn revision of nearest svn parent |
ed42f6e5705a
Clean up help text, document subcommands.
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
62 """ |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
63 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
64 ui_=ui) |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
65 svn_commit_hashes = dict(zip(hge.revmap.itervalues(), |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
66 hge.revmap.iterkeys())) |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
67 ha = repo.parents()[0] |
99
1da7aafdd323
Refactored outgoing_revisions into util where it really belongs.
Augie Fackler <durin42@gmail.com>
parents:
95
diff
changeset
|
68 o_r = util.outgoing_revisions(ui, repo, hge, svn_commit_hashes) |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
69 if o_r: |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
70 ha = repo[o_r[-1]].parents()[0] |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
71 if ha.node() != node.nullid: |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
72 r, br = svn_commit_hashes[ha.node()] |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
73 ui.status('Working copy parent revision is %s: r%s on %s\n' % |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
74 (ha, r, br or 'trunk')) |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
75 else: |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
76 ui.status('Working copy seems to have no parent svn revision.\n') |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
77 return 0 |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
78 |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
79 |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
80 @util.register_subcommand('rebase') |
150
58ae90a65f41
push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents:
149
diff
changeset
|
81 def rebase_commits(ui, repo, hg_repo_path, extrafn=None, **opts): |
115
ed42f6e5705a
Clean up help text, document subcommands.
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
82 """Rebases current unpushed revisions onto Subversion head |
64
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
83 |
08be8ee73551
Add an hg svn info subsubcommand that prints out what you would expect from svn info.
Augie Fackler <durin42@gmail.com>
parents:
31
diff
changeset
|
84 This moves a line of development from making its own head to the top of |
31
05800c403321
Fix up the rebase docstring to be less vague.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
85 Subversion development, linearizing the changes. In order to make sure you |
05800c403321
Fix up the rebase docstring to be less vague.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
86 rebase on top of the current top of Subversion work, you should probably run |
05800c403321
Fix up the rebase docstring to be less vague.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
87 'hg svn pull' before running this. |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
88 """ |
150
58ae90a65f41
push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents:
149
diff
changeset
|
89 if extrafn is None: |
58ae90a65f41
push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents:
149
diff
changeset
|
90 def extrafn2(ctx, extra): |
58ae90a65f41
push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents:
149
diff
changeset
|
91 """defined here so we can add things easily. |
58ae90a65f41
push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents:
149
diff
changeset
|
92 """ |
58ae90a65f41
push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents:
149
diff
changeset
|
93 extra['branch'] = ctx.branch() |
58ae90a65f41
push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents:
149
diff
changeset
|
94 extrafn = extrafn2 |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
95 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
96 ui_=ui) |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
97 svn_commit_hashes = dict(zip(hge.revmap.itervalues(), |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
98 hge.revmap.iterkeys())) |
99
1da7aafdd323
Refactored outgoing_revisions into util where it really belongs.
Augie Fackler <durin42@gmail.com>
parents:
95
diff
changeset
|
99 o_r = util.outgoing_revisions(ui, repo, hge, svn_commit_hashes) |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
100 if not o_r: |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
101 ui.status('Nothing to rebase!\n') |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
102 return 0 |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
103 if len(repo.parents()[0].children()): |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
104 ui.status('Refusing to rebase non-head commit like a coward\n') |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
105 return 0 |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
106 parent_rev = repo[o_r[-1]].parents()[0] |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
107 target_rev = parent_rev |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
108 p_n = parent_rev.node() |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
109 exhausted_choices = False |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
110 while target_rev.children() and not exhausted_choices: |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
111 for c in target_rev.children(): |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
112 exhausted_choices = True |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
113 n = c.node() |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
114 if (n in svn_commit_hashes and |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
115 svn_commit_hashes[n][1] == svn_commit_hashes[p_n][1]): |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
116 target_rev = c |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
117 exhausted_choices = False |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
118 break |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
119 if parent_rev == target_rev: |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
120 ui.status('Already up to date!\n') |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
121 return 0 |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
122 # TODO this is really hacky, there must be a more direct way |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
123 return rebase.rebase(ui, repo, dest=node.hex(target_rev.node()), |
149
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
115
diff
changeset
|
124 base=node.hex(repo.parents()[0].node()), |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
115
diff
changeset
|
125 extrafn=extrafn) |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
126 |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
127 |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
128 @util.register_subcommand('outgoing') |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
129 def show_outgoing_to_svn(ui, repo, hg_repo_path, **opts): |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
130 """Commit the current revision and any required parents back to svn. |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
131 """ |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
132 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
133 ui_=ui) |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
134 svn_commit_hashes = dict(zip(hge.revmap.itervalues(), |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
135 hge.revmap.iterkeys())) |
99
1da7aafdd323
Refactored outgoing_revisions into util where it really belongs.
Augie Fackler <durin42@gmail.com>
parents:
95
diff
changeset
|
136 o_r = util.outgoing_revisions(ui, repo, hge, svn_commit_hashes) |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
137 if not (o_r and len(o_r)): |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
138 ui.status('No outgoing changes found.\n') |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
139 return 0 |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
140 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=False) |
95
10dd34deac3b
utility_commands: fix outgoing against crew (required because of crew cset 87158be081b8)
Augie Fackler <durin42@gmail.com>
parents:
64
diff
changeset
|
141 for node in reversed(o_r): |
10dd34deac3b
utility_commands: fix outgoing against crew (required because of crew cset 87158be081b8)
Augie Fackler <durin42@gmail.com>
parents:
64
diff
changeset
|
142 displayer.show(repo[node]) |