Mercurial > hgsubversion
comparison svncommands.py @ 244:28d0ee605308
Move diff to svncommands.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Wed, 08 Apr 2009 18:21:47 +0200 |
parents | 06130689a2c8 |
children | 074f27c68818 |
comparison
equal
deleted
inserted
replaced
243:2027f851d60c | 244:28d0ee605308 |
---|---|
1 import os | 1 import os |
2 | 2 |
3 from mercurial import hg | 3 from mercurial import hg |
4 from mercurial import node | 4 from mercurial import node |
5 from mercurial import patch | |
5 from mercurial import util as hgutil | 6 from mercurial import util as hgutil |
6 | 7 |
7 from svn import core | 8 from svn import core |
8 from svn import delta | 9 from svn import delta |
9 | 10 |
183 util.swap_out_encoding(old_encoding) | 184 util.swap_out_encoding(old_encoding) |
184 return 0 | 185 return 0 |
185 push = util.register_subcommand('push')(push) | 186 push = util.register_subcommand('push')(push) |
186 # for git expats | 187 # for git expats |
187 dcommit = util.register_subcommand('dcommit')(push) | 188 dcommit = util.register_subcommand('dcommit')(push) |
189 | |
190 | |
191 def diff(ui, repo, hg_repo_path, **opts): | |
192 """show a diff of the most recent revision against its parent from svn | |
193 """ | |
194 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, | |
195 ui_=ui) | |
196 svn_commit_hashes = dict(zip(hge.revmap.itervalues(), | |
197 hge.revmap.iterkeys())) | |
198 parent = repo.parents()[0] | |
199 o_r = util.outgoing_revisions(ui, repo, hge, svn_commit_hashes, parent.node()) | |
200 if o_r: | |
201 parent = repo[o_r[-1]].parents()[0] | |
202 base_rev, _junk = svn_commit_hashes[parent.node()] | |
203 it = patch.diff(repo, parent.node(), None, | |
204 opts=patch.diffopts(ui, opts={'git': True, | |
205 'show_function': False, | |
206 'ignore_all_space': False, | |
207 'ignore_space_change': False, | |
208 'ignore_blank_lines': False, | |
209 'unified': True, | |
210 'text': False, | |
211 })) | |
212 ui.write(cmdutil.filterdiff(''.join(it), base_rev)) | |
213 diff = util.register_subcommand('diff')(diff) |