Mercurial > hgsubversion
changeset 446:cbd230043379
svncommands: get update working again
Needs tests. May be better as a wrapper, triggering on r\d+.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Tue, 16 Jun 2009 14:10:57 +0200 |
parents | 24a8471069c0 |
children | 0d3b5acb1d51 |
files | hgsubversion/svncommands.py |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/svncommands.py +++ b/hgsubversion/svncommands.py @@ -6,6 +6,7 @@ from mercurial import node from mercurial import util as hgutil import svnwrap +import svnmeta import util import utility_commands import svnexternals @@ -185,24 +186,27 @@ def help(ui, args=None, **opts): def update(ui, args, repo, clean=False, **opts): """update to a specified Subversion revision number """ + assert len(args) == 1 rev = int(args[0]) - path = os.path.join(repo.path, 'svn', 'rev_map') + meta = svnmeta.SVNMeta(repo) + answers = [] - for k,v in util.parse_revmap(path).iteritems(): + for k, v in meta.revmap.iteritems(): if k[0] == rev: answers.append((v, k[1])) + if len(answers) == 1: if clean: return hg.clean(repo, answers[0][0]) return hg.update(repo, answers[0][0]) elif len(answers) == 0: - ui.status('Revision %s did not produce an hg revision.\n' % rev) + ui.status('revision %s did not produce an hg revision\n' % rev) return 1 else: - ui.status('Ambiguous revision!\n') - ui.status('\n'.join(['%s on %s' % (node.hex(a[0]), a[1]) for a in - answers]+[''])) + ui.status('ambiguous revision!\n') + revs = ['%s on %s' % (node.hex(a[0]), a[1]) for a in answers] + [''] + ui.status('\n'.join(revs)) return 1