Patchwork [2,of,8] debugcommands: move 'debugsetparents' in the new module

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 14, 2017, 6:43 p.m.
Message ID <4df6f88591c6e70eddda.1487097782@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/18488/
State Accepted
Headers show

Comments

Pierre-Yves David - Feb. 14, 2017, 6:43 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1486026242 -3600
#      Thu Feb 02 10:04:02 2017 +0100
# Node ID 4df6f88591c6e70edddadea4bf6e5cb1f8e87b3a
# Parent  653ec80df7ae21c16a7b42e0cee3abda47bd8c23
# EXP-Topic debugcommands
debugcommands: move 'debugsetparents' in the new module

Patch

diff -r 653ec80df7ae -r 4df6f88591c6 mercurial/commands.py
--- a/mercurial/commands.py	Thu Feb 02 10:03:31 2017 +0100
+++ b/mercurial/commands.py	Thu Feb 02 10:04:02 2017 +0100
@@ -1855,24 +1855,6 @@  def copy(ui, repo, *pats, **opts):
     with repo.wlock(False):
         return cmdutil.copy(ui, repo, pats, opts)
 
-@command('debugsetparents', [], _('REV1 [REV2]'))
-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. For example, neither the working directory nor the
-    dirstate is updated, so file status may be incorrect after running this
-    command.
-
-    Returns 0 on success.
-    """
-
-    r1 = scmutil.revsingle(repo, rev1).node()
-    r2 = scmutil.revsingle(repo, rev2, 'null').node()
-
-    with repo.wlock():
-        repo.setparents(r1, r2)
-
 @command('debugdirstate|debugstate',
     [('', 'nodates', None, _('do not display the saved mtime')),
     ('', 'datesort', None, _('sort by saved mtime'))],
diff -r 653ec80df7ae -r 4df6f88591c6 mercurial/debugcommands.py
--- a/mercurial/debugcommands.py	Thu Feb 02 10:03:31 2017 +0100
+++ b/mercurial/debugcommands.py	Thu Feb 02 10:04:02 2017 +0100
@@ -1835,6 +1835,24 @@  def debugrevspec(ui, repo, expr, **opts)
     for c in revs:
         ui.write("%s\n" % c)
 
+@command('debugsetparents', [], _('REV1 [REV2]'))
+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. For example, neither the working directory nor the
+    dirstate is updated, so file status may be incorrect after running this
+    command.
+
+    Returns 0 on success.
+    """
+
+    r1 = scmutil.revsingle(repo, rev1).node()
+    r2 = scmutil.revsingle(repo, rev2, 'null').node()
+
+    with repo.wlock():
+        repo.setparents(r1, r2)
+
 @command('debugupgraderepo', [
     ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
     ('', 'run', False, _('performs an upgrade')),