Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 1262:325c07fd2ebd
Add debugancestor command
author | mpm@selenic.com |
---|---|
date | Fri, 16 Sep 2005 10:42:20 -0700 |
parents | fe7fbfdb066d |
children | b0633406c07a |
comparison
equal
deleted
inserted
replaced
1261:fccc90f1994e | 1262:325c07fd2ebd |
---|---|
786 | 786 |
787 def copy(ui, repo, *pats, **opts): | 787 def copy(ui, repo, *pats, **opts): |
788 """mark files as copied for the next commit""" | 788 """mark files as copied for the next commit""" |
789 errs, copied = docopy(ui, repo, pats, opts) | 789 errs, copied = docopy(ui, repo, pats, opts) |
790 return errs | 790 return errs |
791 | |
792 def debugancestor(ui, index, rev1, rev2): | |
793 """find the ancestor revision of two revisions in a given index""" | |
794 r = revlog.revlog(file, index, "") | |
795 a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) | |
796 ui.write("%d:%s\n" % (r.rev(a), hex(a))) | |
791 | 797 |
792 def debugcheckstate(ui, repo): | 798 def debugcheckstate(ui, repo): |
793 """validate the correctness of the current dirstate""" | 799 """validate the correctness of the current dirstate""" |
794 parent1, parent2 = repo.dirstate.parents() | 800 parent1, parent2 = repo.dirstate.parents() |
795 repo.dirstate.read() | 801 repo.dirstate.read() |
1799 ('X', 'exclude', [], 'exclude path from search'), | 1805 ('X', 'exclude', [], 'exclude path from search'), |
1800 ('A', 'after', None, 'record a copy after it has happened'), | 1806 ('A', 'after', None, 'record a copy after it has happened'), |
1801 ('f', 'force', None, 'replace destination if it exists'), | 1807 ('f', 'force', None, 'replace destination if it exists'), |
1802 ('p', 'parents', None, 'append source path to dest')], | 1808 ('p', 'parents', None, 'append source path to dest')], |
1803 'hg copy [OPTION]... [SOURCE]... DEST'), | 1809 'hg copy [OPTION]... [SOURCE]... DEST'), |
1810 "debugancestor": (debugancestor, [], 'debugancestor INDEX REV1 REV2'), | |
1804 "debugcheckstate": (debugcheckstate, [], 'debugcheckstate'), | 1811 "debugcheckstate": (debugcheckstate, [], 'debugcheckstate'), |
1805 "debugconfig": (debugconfig, [], 'debugconfig'), | 1812 "debugconfig": (debugconfig, [], 'debugconfig'), |
1806 "debugstate": (debugstate, [], 'debugstate'), | 1813 "debugstate": (debugstate, [], 'debugstate'), |
1807 "debugdata": (debugdata, [], 'debugdata FILE REV'), | 1814 "debugdata": (debugdata, [], 'debugdata FILE REV'), |
1808 "debugindex": (debugindex, [], 'debugindex FILE'), | 1815 "debugindex": (debugindex, [], 'debugindex FILE'), |
1981 ('', 'profile', None, 'profile'), | 1988 ('', 'profile', None, 'profile'), |
1982 ('', 'version', None, 'output version information and exit'), | 1989 ('', 'version', None, 'output version information and exit'), |
1983 ('h', 'help', None, 'display help and exit'), | 1990 ('h', 'help', None, 'display help and exit'), |
1984 ] | 1991 ] |
1985 | 1992 |
1986 norepo = ("clone init version help debugconfig debugdata" | 1993 norepo = ("clone init version help debugancestor debugconfig debugdata" |
1987 " debugindex debugindexdot paths") | 1994 " debugindex debugindexdot paths") |
1988 | 1995 |
1989 def find(cmd): | 1996 def find(cmd): |
1990 for e in table.keys(): | 1997 for e in table.keys(): |
1991 if re.match("(%s)$" % e, cmd): | 1998 if re.match("(%s)$" % e, cmd): |