annotate utility_commands.py @ 95:10dd34deac3b

utility_commands: fix outgoing against crew (required because of crew cset 87158be081b8)
author Augie Fackler <durin42@gmail.com>
date Wed, 19 Nov 2008 10:23:48 -0600
parents 08be8ee73551
children 1da7aafdd323
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
95
10dd34deac3b utility_commands: fix outgoing against crew (required because of crew cset 87158be081b8)
Augie Fackler <durin42@gmail.com>
parents: 64
diff changeset
1 from mercurial import context
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2 from mercurial import cmdutil
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 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
4 from mercurial import util as mutil
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5 from hgext import rebase
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
7 import util
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
8 import hg_delta_editor
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
10 @util.register_subcommand('url')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
11 def print_wc_url(ui, repo, hg_repo_path, **opts):
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12 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
13 ui_=ui)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14 ui.status(hge.url, '\n')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
15
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
16
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
17 @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
18 def run_svn_info(ui, repo, hg_repo_path, **opts):
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 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
20 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
21 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
22 hge.revmap.iterkeys()))
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 o_r = outgoing_revisions(ui, repo, hge, svn_commit_hashes)
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 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
25 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
26 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
27 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
28 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
29 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
30 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
31 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
32 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
33 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
34 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
35 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
36 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
37 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
38 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
39 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
40 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
41 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
42 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
43 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
44 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
45 {'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
46 '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
47 '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
48 '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
49 '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
50 # 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
51 '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
52 '%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
53 })
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
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
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
56 @util.register_subcommand('parent')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
57 def print_parent_revision(ui, repo, hg_repo_path, **opts):
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
58 """Prints the hg hash and svn revision info for the nearest svn parent of
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
59 the current revision"""
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
60 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
61 ui_=ui)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
62 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
63 hge.revmap.iterkeys()))
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
64 ha = repo.parents()[0]
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
65 o_r = outgoing_revisions(ui, repo, hge, svn_commit_hashes)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
66 if o_r:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
67 ha = repo[o_r[-1]].parents()[0]
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
68 if ha.node() != node.nullid:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
69 r, br = svn_commit_hashes[ha.node()]
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
70 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
71 (ha, r, br or 'trunk'))
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
72 else:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
73 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
74 return 0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
75
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
76
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
77 @util.register_subcommand('rebase')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
78 def rebase_commits(ui, repo, hg_repo_path, **opts):
31
05800c403321 Fix up the rebase docstring to be less vague.
Augie Fackler <durin42@gmail.com>
parents: 0
diff changeset
79 """Rebases the current unpushed revisions onto the top of the Subversion branch.
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
80
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
81 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
82 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
83 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
84 'hg svn pull' before running this.
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
85 """
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
86 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
87 ui_=ui)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
88 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
89 hge.revmap.iterkeys()))
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
90 o_r = outgoing_revisions(ui, repo, hge, svn_commit_hashes)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
91 if not o_r:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
92 ui.status('Nothing to rebase!\n')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
93 return 0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
94 if len(repo.parents()[0].children()):
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
95 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
96 return 0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
97 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
98 target_rev = parent_rev
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
99 p_n = parent_rev.node()
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
100 exhausted_choices = False
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
101 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
102 for c in target_rev.children():
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
103 exhausted_choices = True
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
104 n = c.node()
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
105 if (n in svn_commit_hashes and
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
106 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
107 target_rev = c
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
108 exhausted_choices = False
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
109 break
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
110 if parent_rev == target_rev:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
111 ui.status('Already up to date!\n')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
112 return 0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
113 # 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
114 return rebase.rebase(ui, repo, dest=node.hex(target_rev.node()),
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
115 base=node.hex(repo.parents()[0].node()))
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
116
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
117
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
118 @util.register_subcommand('outgoing')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
119 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
120 """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
121 """
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
122 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
123 ui_=ui)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
124 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
125 hge.revmap.iterkeys()))
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
126 o_r = outgoing_revisions(ui, repo, hge, svn_commit_hashes)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
127 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
128 ui.status('No outgoing changes found.\n')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
129 return 0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
130 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
131 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
132 displayer.show(repo[node])
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
133
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
134
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
135 def outgoing_revisions(ui, repo, hg_editor, reverse_map):
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
136 """Given a repo and an hg_editor, determines outgoing revisions for the
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
137 current working copy state.
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
138 """
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
139 outgoing_rev_hashes = []
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
140 working_rev = repo.parents()
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
141 assert len(working_rev) == 1
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
142 working_rev = working_rev[0]
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
143 if working_rev.node() in reverse_map:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
144 return
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
145 while (not working_rev.node() in reverse_map
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
146 and working_rev.node() != node.nullid):
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
147 outgoing_rev_hashes.append(working_rev.node())
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
148 working_rev = working_rev.parents()
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
149 assert len(working_rev) == 1
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
150 working_rev = working_rev[0]
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
151 if working_rev.node() != node.nullid:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
152 return outgoing_rev_hashes