Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 1755:a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
- added and removed files will be lost while recreating the dirstate
- modifications are not lost
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Mon, 20 Feb 2006 19:04:56 +0100 |
parents | fdfe89a3962d |
children | 23012d48ae91 13f8e068d13c |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Feb 20 01:12:03 2006 +0100 +++ b/mercurial/commands.py Mon Feb 20 19:04:56 2006 +0100 @@ -985,6 +985,18 @@ a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) ui.write("%d:%s\n" % (r.rev(a), hex(a))) +def debugrebuildstate(ui, repo, rev=None): + """rebuild the dirstate as it would look like for the given revision""" + if not rev: + rev = repo.changelog.tip() + else: + rev = repo.lookup(rev) + change = repo.changelog.read(rev) + n = change[0] + files = repo.manifest.readflags(n) + wlock = self.repo.wlock() + repo.dirstate.rebuild(rev, files.iteritems()) + def debugcheckstate(ui, repo): """validate the correctness of the current dirstate""" parent1, parent2 = repo.dirstate.parents() @@ -2359,6 +2371,10 @@ _('forcibly copy over an existing managed file'))], _('hg copy [OPTION]... [SOURCE]... DEST')), "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), + "debugrebuildstate": + (debugrebuildstate, + [('r', 'rev', "", _("revision to rebuild to"))], + _('debugrebuildstate [-r REV] [REV]')), "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), "debugconfig": (debugconfig, [], _('debugconfig')), "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')),