[PATCH 2 of 3] shelve: do not update when keeping changes, just set the right parent

Jordi GutiƩrrez Hermoso jordigh at octave.org
Fri Mar 22 11:29:49 EDT 2019


# HG changeset patch
# User Jordi GutiƩrrez Hermoso <jordigh at octave.org>
# Date 1553268335 14400
#      Fri Mar 22 11:25:35 2019 -0400
# Node ID 6bff7f54a5f20e72e63edbceb2a34d86fb4c86f4
# Parent  773e8b313d28d85002c459ea69d3671e7a0bc05e
shelve: do not update when keeping changes, just set the right parent

This is not enough to enable `shelve --keep` to work, but it's a
necessary first step.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -506,7 +506,10 @@ def _docreatecmd(ui, repo, pats, opts):
         if ui.formatted():
             desc = stringutil.ellipsis(desc, ui.termwidth())
         ui.status(_('shelved as %s\n') % name)
-        hg.update(repo, parent.node())
+        if opts['keep']:
+            repo.setparents(parent.node(), nodemod.nullid)
+        else:
+            hg.update(repo, parent.node())
         if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts):
             repo.dirstate.setbranch(origbranch)
 


More information about the Mercurial-devel mailing list