Mercurial > hgsubversion
comparison wrappers.py @ 283:521d9c1bb11d
Implement -u/--update support when pulling.
Status messages now more closely follow standard hg pull. Added generic pull
tests as well as specific tests for this change.
author | Martijn Pieters <mj@zopatista.com> |
---|---|
date | Mon, 27 Apr 2009 09:39:39 -0500 |
parents | 60acc38eac96 |
children | f8f9a2993705 |
comparison
equal
deleted
inserted
replaced
282:77892f67b1cd | 283:521d9c1bb11d |
---|---|
6 from mercurial import commands | 6 from mercurial import commands |
7 from mercurial import patch | 7 from mercurial import patch |
8 from mercurial import hg | 8 from mercurial import hg |
9 from mercurial import util as hgutil | 9 from mercurial import util as hgutil |
10 from mercurial import node | 10 from mercurial import node |
11 from mercurial import i18n | |
11 | 12 |
12 from svn import core | 13 from svn import core |
13 from svn import delta | 14 from svn import delta |
14 | 15 |
15 import cmdutil | 16 import cmdutil |
286 | 287 |
287 if initializing_repo and start > 0: | 288 if initializing_repo and start > 0: |
288 raise hgutil.Abort('Revision skipping at repository initialization ' | 289 raise hgutil.Abort('Revision skipping at repository initialization ' |
289 'remains unimplemented.') | 290 'remains unimplemented.') |
290 | 291 |
292 revisions = 0 | |
293 if not initializing_repo: | |
294 oldheads = len(repo.changelog.heads()) | |
295 | |
291 # start converting revisions | 296 # start converting revisions |
292 for r in svn.revisions(start=start): | 297 for r in svn.revisions(start=start): |
293 valid = True | 298 valid = True |
294 hg_editor.update_branch_tag_map_for_rev(r) | 299 hg_editor.update_branch_tag_map_for_rev(r) |
295 for p in r.paths: | 300 for p in r.paths: |
320 and tries < 3): | 325 and tries < 3): |
321 tries += 1 | 326 tries += 1 |
322 ui.status('Got a 502, retrying (%s)\n' % tries) | 327 ui.status('Got a 502, retrying (%s)\n' % tries) |
323 else: | 328 else: |
324 raise hgutil.Abort(*e.args) | 329 raise hgutil.Abort(*e.args) |
330 revisions += 1 | |
325 util.swap_out_encoding(old_encoding) | 331 util.swap_out_encoding(old_encoding) |
332 | |
333 if revisions == 0: | |
334 ui.status(i18n._("no changes found\n")) | |
335 return | |
336 else: | |
337 ui.status("added %d svn revisions\n" % revisions) | |
338 if not initializing_repo: | |
339 newheads = len(repo.changelog.heads()) | |
340 # postincoming needs to know if heads were added or removed | |
341 # calculation based on mercurial.localrepo.addchangegroup | |
342 # 0 means no changes, 1 no new heads, > 1 new heads, < 0 heads removed | |
343 modheads = newheads - oldheads + (newheads < oldheads and -1 or 1) | |
344 commands.postincoming(ui, repo, modheads, opts.get('update'), None) | |
326 | 345 |
327 | 346 |
328 def rebase(orig, ui, repo, **opts): | 347 def rebase(orig, ui, repo, **opts): |
329 """rebase current unpushed revisions onto the Subversion head | 348 """rebase current unpushed revisions onto the Subversion head |
330 | 349 |