Mercurial > hgsubversion
comparison utility_commands.py @ 181:e37f9d3fd5e7
remove decorators (compat with python2.3)
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Tue, 13 Jan 2009 13:59:50 +0100 |
parents | a05250261102 |
children | 57355b0e7bd1 |
comparison
equal
deleted
inserted
replaced
180:3f1e8a5ec9dd | 181:e37f9d3fd5e7 |
---|---|
4 from hgext import rebase | 4 from hgext import rebase |
5 | 5 |
6 import util | 6 import util |
7 import hg_delta_editor | 7 import hg_delta_editor |
8 | 8 |
9 @util.register_subcommand('url') | |
10 def print_wc_url(ui, repo, hg_repo_path, **opts): | 9 def print_wc_url(ui, repo, hg_repo_path, **opts): |
11 """Url of Subversion repository. | 10 """Url of Subversion repository. |
12 """ | 11 """ |
13 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, | 12 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, |
14 ui_=ui) | 13 ui_=ui) |
15 ui.status(hge.url, '\n') | 14 ui.status(hge.url, '\n') |
15 print_wc_url = util.register_subcommand('url')(print_wc_url) | |
16 | 16 |
17 | 17 |
18 @util.register_subcommand('info') | |
19 def run_svn_info(ui, repo, hg_repo_path, **opts): | 18 def run_svn_info(ui, repo, hg_repo_path, **opts): |
20 """Like svn info details. | 19 """Like svn info details. |
21 """ | 20 """ |
22 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, | 21 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, |
23 ui_=ui) | 22 ui_=ui) |
55 'revision': r, | 54 'revision': r, |
56 # TODO I'd like to format this to the user's local TZ if possible | 55 # TODO I'd like to format this to the user's local TZ if possible |
57 'date': mutil.datestr(workingctx.date(), | 56 'date': mutil.datestr(workingctx.date(), |
58 '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)') | 57 '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)') |
59 }) | 58 }) |
59 run_svn_info = util.register_subcommand('info')(run_svn_info) | |
60 | 60 |
61 | 61 |
62 @util.register_subcommand('parent') | |
63 def print_parent_revision(ui, repo, hg_repo_path, **opts): | 62 def print_parent_revision(ui, repo, hg_repo_path, **opts): |
64 """Display hg hash and svn revision of nearest svn parent. | 63 """Display hg hash and svn revision of nearest svn parent. |
65 """ | 64 """ |
66 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, | 65 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, |
67 ui_=ui) | 66 ui_=ui) |
76 ui.status('Working copy parent revision is %s: r%s on %s\n' % | 75 ui.status('Working copy parent revision is %s: r%s on %s\n' % |
77 (ha, r, br or 'trunk')) | 76 (ha, r, br or 'trunk')) |
78 else: | 77 else: |
79 ui.status('Working copy seems to have no parent svn revision.\n') | 78 ui.status('Working copy seems to have no parent svn revision.\n') |
80 return 0 | 79 return 0 |
80 print_parent_revision = util.register_subcommand('parent')(print_parent_revision) | |
81 | 81 |
82 | 82 |
83 @util.register_subcommand('rebase') | |
84 def rebase_commits(ui, repo, hg_repo_path, extrafn=None, sourcerev=None, **opts): | 83 def rebase_commits(ui, repo, hg_repo_path, extrafn=None, sourcerev=None, **opts): |
85 """Rebases current unpushed revisions onto Subversion head. | 84 """Rebases current unpushed revisions onto Subversion head. |
86 | 85 |
87 This moves a line of development from making its own head to the top of | 86 This moves a line of development from making its own head to the top of |
88 Subversion development, linearizing the changes. In order to make sure you | 87 Subversion development, linearizing the changes. In order to make sure you |
126 return 0 | 125 return 0 |
127 # TODO this is really hacky, there must be a more direct way | 126 # TODO this is really hacky, there must be a more direct way |
128 return rebase.rebase(ui, repo, dest=node.hex(target_rev.node()), | 127 return rebase.rebase(ui, repo, dest=node.hex(target_rev.node()), |
129 base=node.hex(sourcerev), | 128 base=node.hex(sourcerev), |
130 extrafn=extrafn) | 129 extrafn=extrafn) |
130 rebase_commits = util.register_subcommand('rebase')(rebase_commits) | |
131 | 131 |
132 | 132 |
133 @util.register_subcommand('outgoing') | |
134 def show_outgoing_to_svn(ui, repo, hg_repo_path, **opts): | 133 def show_outgoing_to_svn(ui, repo, hg_repo_path, **opts): |
135 """Show changesets not yet pushed to SVN. | 134 """Show changesets not yet pushed to SVN. |
136 """ | 135 """ |
137 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, | 136 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, |
138 ui_=ui) | 137 ui_=ui) |
143 ui.status('No outgoing changes found.\n') | 142 ui.status('No outgoing changes found.\n') |
144 return 0 | 143 return 0 |
145 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=False) | 144 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=False) |
146 for node in reversed(o_r): | 145 for node in reversed(o_r): |
147 displayer.show(repo[node]) | 146 displayer.show(repo[node]) |
147 show_outgoing_to_svn = util.register_subcommand('outgoing')(show_outgoing_to_svn) |