Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 6253:a7e3d0456d92
debugancestor: use repo.lookup when no revlog was specified
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 14 Mar 2008 09:56:58 -0300 |
parents | 437eef39458d |
children | de7256c82fad |
comparison
equal
deleted
inserted
replaced
6252:f21f6de16d41 | 6253:a7e3d0456d92 |
---|---|
572 def debugancestor(ui, repo, *args): | 572 def debugancestor(ui, repo, *args): |
573 """find the ancestor revision of two revisions in a given index""" | 573 """find the ancestor revision of two revisions in a given index""" |
574 if len(args) == 3: | 574 if len(args) == 3: |
575 index, rev1, rev2 = args | 575 index, rev1, rev2 = args |
576 r = revlog.revlog(util.opener(os.getcwd(), audit=False), index) | 576 r = revlog.revlog(util.opener(os.getcwd(), audit=False), index) |
577 lookup = r.lookup | |
577 elif len(args) == 2: | 578 elif len(args) == 2: |
578 if not repo: | 579 if not repo: |
579 raise util.Abort(_("There is no Mercurial repository here " | 580 raise util.Abort(_("There is no Mercurial repository here " |
580 "(.hg not found)")) | 581 "(.hg not found)")) |
581 rev1, rev2 = args | 582 rev1, rev2 = args |
582 r = repo.changelog | 583 r = repo.changelog |
584 lookup = repo.lookup | |
583 else: | 585 else: |
584 raise util.Abort(_('either two or three arguments required')) | 586 raise util.Abort(_('either two or three arguments required')) |
585 a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) | 587 a = r.ancestor(lookup(rev1), lookup(rev2)) |
586 ui.write("%d:%s\n" % (r.rev(a), hex(a))) | 588 ui.write("%d:%s\n" % (r.rev(a), hex(a))) |
587 | 589 |
588 def debugcomplete(ui, cmd='', **opts): | 590 def debugcomplete(ui, cmd='', **opts): |
589 """returns the completion list associated with the given command""" | 591 """returns the completion list associated with the given command""" |
590 | 592 |