changeset 1395:c2eb204917f8

Add debugsetparents command
author Matt Mackall <mpm@selenic.com>
date Tue, 18 Oct 2005 00:43:33 -0700
parents b20b683e8d95
children 8c3e2a254257
files mercurial/commands.py
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Oct 18 00:43:19 2005 -0700
+++ b/mercurial/commands.py	Tue Oct 18 00:43:33 2005 -0700
@@ -836,6 +836,19 @@
     for section, name, value in ui.walkconfig():
         ui.write('%s.%s=%s\n' % (section, name, value))
 
+def debugsetparents(ui, repo, rev1, rev2=None):
+    """
+    manually set the parents of the current working directory
+
+    This is useful for writing repository conversion tools, but should
+    be used with care.
+    """
+
+    if not rev2:
+        rev2 = hex(nullid)
+
+    repo.dirstate.setparents(repo.lookup(rev1), repo.lookup(rev2))
+
 def debugstate(ui, repo):
     """show the contents of the current dirstate"""
     repo.dirstate.read()
@@ -1811,6 +1824,7 @@
     "debugancestor": (debugancestor, [], 'debugancestor INDEX REV1 REV2'),
     "debugcheckstate": (debugcheckstate, [], 'debugcheckstate'),
     "debugconfig": (debugconfig, [], 'debugconfig'),
+    "debugsetparents": (debugsetparents, [], 'debugsetparents REV1 [REV2]'),
     "debugstate": (debugstate, [], 'debugstate'),
     "debugdata": (debugdata, [], 'debugdata FILE REV'),
     "debugindex": (debugindex, [], 'debugindex FILE'),