Patchwork [23,of,25,RFC] shelve: add a "internal" extra

login
register
mail settings
Submitter Boris Feld
Date June 7, 2018, 2:11 p.m.
Message ID <97a1e0703c90bf392e75.1528380682@Laptop-Boris.lan>
Download mbox | patch
Permalink /patch/32018/
State New
Headers show

Comments

Boris Feld - June 7, 2018, 2:11 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1528242397 -7200
#      Wed Jun 06 01:46:37 2018 +0200
# Node ID 97a1e0703c90bf392e759f3d3e463b2f79110a7a
# Parent  40db0e66b6fe7ba86ea97de71140fe3f021863ac
# EXP-Topic internal-phase
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 97a1e0703c90
shelve: add a "internal" extra

Keeping shelve changeset around increase the risk of collision with normal
changeset. To prevent such collision and help with overall clarity, we add an
'internal' key in extra that mark the changeset as created by "shelve".

Node change is tests are expected.

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -459,7 +459,7 @@  def _docreatecmd(ui, repo, pats, opts):
 
         name = getshelvename(repo, parent, opts)
         activebookmark = _backupactivebookmark(repo)
-        extra = {}
+        extra = {'internal': 'shelve'}
         if includeunknown:
             _includeunknownfiles(repo, pats, opts, extra)
 
@@ -742,7 +742,8 @@  def _commitworkingcopychanges(ui, repo, 
         return tmpwctx, addedbefore
     ui.status(_("temporarily committing pending changes "
                 "(restore with 'hg unshelve --abort')\n"))
-    commitfunc = getcommitfunc(extra=None, interactive=False,
+    extra = {'internal': 'shelve'}
+    commitfunc = getcommitfunc(extra=extra, interactive=False,
                                editor=False)
     tempopts = {}
     tempopts['message'] = "pending changes temporary commit"
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -384,11 +384,11 @@  ensure that we have a merge with unresol
   +++ b/a/a
   @@ -1,2 +1,6 @@
    a
-  +<<<<<<< shelve:       562f7831e574 - shelve: pending changes temporary commit
+  +<<<<<<< shelve:       2377350b6337 - shelve: pending changes temporary commit
    c
   +=======
   +a
-  +>>>>>>> working-copy: 32c69314e062 - shelve: changes to: [mq]: second.patch
+  +>>>>>>> working-copy: a68ec3400638 - shelve: changes to: [mq]: second.patch
   diff --git a/b/b b/b.rename/b
   rename from b/b
   rename to b.rename/b
@@ -806,11 +806,11 @@  unshelve and conflicts with tracked and 
   M f
   ? f.orig
   $ cat f
-  <<<<<<< shelve:       5f6b880e719b - shelve: pending changes temporary commit
+  <<<<<<< shelve:       d44eae5c3d33 - shelve: pending changes temporary commit
   g
   =======
   f
-  >>>>>>> working-copy: 81152db69da7 - shelve: changes to: commit stuff
+  >>>>>>> working-copy: aef214a5229c - shelve: changes to: commit stuff
   $ cat f.orig
   g
   $ hg unshelve --abort -t false
@@ -852,7 +852,7 @@  unshelve and conflicts with tracked and 
   g
   =======
   f
-  >>>>>>> working-copy: 81152db69da7 - shelve: changes to: commit stuff
+  >>>>>>> working-copy: aef214a5229c - shelve: changes to: commit stuff
   $ cat f.orig
   g
   $ hg unshelve --abort
@@ -1089,7 +1089,7 @@  no general delta
   shelved as default
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg debugbundle .hg/shelved/*.hg
-  45993d65fe9dc3c6d8764b9c3b07fa831ee7d92d
+  330882a04d2ce8487636b1fb292e5beea77fa1e3
   $ cd ..
 
 with general delta
@@ -1112,7 +1112,7 @@  with general delta
   $ hg debugbundle .hg/shelved/*.hg
   Stream params: {Compression: BZ}
   changegroup -- {nbchanges: 1, version: 02}
-      45993d65fe9dc3c6d8764b9c3b07fa831ee7d92d
+      330882a04d2ce8487636b1fb292e5beea77fa1e3
   $ cd ..
 
 Test visibility of in-memory changes inside transaction to external hook
@@ -1167,15 +1167,15 @@  Test visibility of in-memory changes ins
   temporarily committing pending changes (restore with 'hg unshelve --abort')
   rebasing shelved changes
   ==== preupdate:
-  VISIBLE 6:66b86db80ee4
+  VISIBLE 6:54c00d20fb3f
   ACTUAL  5:703117a2acfb
   ====
   ==== preupdate:
-  VISIBLE 8:92fdbb7b4de7
+  VISIBLE 8:8efe6f7537dc
   ACTUAL  5:703117a2acfb
   ====
   ==== preupdate:
-  VISIBLE 6:66b86db80ee4
+  VISIBLE 6:54c00d20fb3f
   ACTUAL  5:703117a2acfb
   ====
 
@@ -1211,12 +1211,12 @@  Test visibility of in-memory changes ins
   temporarily committing pending changes (restore with 'hg unshelve --abort')
   rebasing shelved changes
   ==== update:
-  VISIBLE 6:66b86db80ee4
-  VISIBLE 7:206bf5d4f922
+  VISIBLE 6:54c00d20fb3f
+  VISIBLE 7:492ed9d705e5
   ACTUAL  5:703117a2acfb
   ====
   ==== update:
-  VISIBLE 6:66b86db80ee4
+  VISIBLE 6:54c00d20fb3f
   ACTUAL  5:703117a2acfb
   ====
   ==== update:
@@ -1752,8 +1752,8 @@  putting v1 shelvedstate file in place of
   > ashelve
   > 8b058dae057a5a78f393f4535d9e363dd5efac9d
   > 8b058dae057a5a78f393f4535d9e363dd5efac9d
-  > 8b058dae057a5a78f393f4535d9e363dd5efac9d 003d2d94241cc7aff0c3a148e966d6a4a377f3a7
-  > 003d2d94241cc7aff0c3a148e966d6a4a377f3a7
+  > 8b058dae057a5a78f393f4535d9e363dd5efac9d f543b27db2cdb41737e2e0008dc524c471da1446
+  > f543b27db2cdb41737e2e0008dc524c471da1446
   > 
   > nokeep
   > :no-active-bookmark