histedit: unify strip backup files on success (BC)
authorJun Wu <quark@fb.com>
Sat, 08 Jul 2017 16:50:31 -0700
changeset 33350 b320ff822c7e
parent 33349 28f75a1695fb
child 33351 154298576d44
histedit: unify strip backup files on success (BC) Previously we wrote two different strip backup files on success. This patch unifies them. It will make scmutil.cleanupnodes migration more smooth.
hgext/histedit.py
tests/test-histedit-arguments.t
tests/test-histedit-bookmark-motion.t
tests/test-histedit-commute.t
tests/test-histedit-fold.t
tests/test-histedit-obsolete.t
--- a/hgext/histedit.py	Sat Jul 08 16:50:31 2017 -0700
+++ b/hgext/histedit.py	Sat Jul 08 16:50:31 2017 -0700
@@ -1171,13 +1171,17 @@
                     for n in succs[1:]:
                         ui.debug(m % node.short(n))
 
-    safecleanupnode(ui, repo, tmpnodes)
-
     if not state.keep:
         if mapping:
             movebookmarks(ui, repo, mapping, state.topmost, ntm)
             # TODO update mq state
-        safecleanupnode(ui, repo, mapping)
+    else:
+        mapping = {}
+
+    for n in tmpnodes:
+        mapping[n] = ()
+
+    safecleanupnode(ui, repo, mapping)
 
     state.clear()
     if os.path.exists(repo.sjoin('undo')):
--- a/tests/test-histedit-arguments.t	Sat Jul 08 16:50:31 2017 -0700
+++ b/tests/test-histedit-arguments.t	Sat Jul 08 16:50:31 2017 -0700
@@ -265,7 +265,6 @@
   HG: branch 'default'
   HG: changed alpha
   saved backup bundle to $TESTTMP/foo/.hg/strip-backup/*-backup.hg (glob)
-  saved backup bundle to $TESTTMP/foo/.hg/strip-backup/*-backup.hg (glob)
 
   $ hg update -q 2
   $ echo x > x
--- a/tests/test-histedit-bookmark-motion.t	Sat Jul 08 16:50:31 2017 -0700
+++ b/tests/test-histedit-bookmark-motion.t	Sat Jul 08 16:50:31 2017 -0700
@@ -87,8 +87,7 @@
   > fold e860deea161a 4 e
   > pick 652413bf663e 5 f
   > EOF
-  saved backup bundle to $TESTTMP/r/.hg/strip-backup/96e494a2d553-3c6c5d92-backup.hg (glob)
-  saved backup bundle to $TESTTMP/r/.hg/strip-backup/d2ae7f538514-48787b8d-backup.hg (glob)
+  saved backup bundle to $TESTTMP/r/.hg/strip-backup/96e494a2d553-45c027ab-backup.hg (glob)
   $ hg log --graph
   @  changeset:   3:cacdfd884a93
   |  bookmark:    five
--- a/tests/test-histedit-commute.t	Sat Jul 08 16:50:31 2017 -0700
+++ b/tests/test-histedit-commute.t	Sat Jul 08 16:50:31 2017 -0700
@@ -418,7 +418,6 @@
 
   $ HGEDITOR="sh ./editor.sh" hg histedit 0
   saved backup bundle to $TESTTMP/issue4251/.hg/strip-backup/*-backup.hg (glob)
-  saved backup bundle to $TESTTMP/issue4251/.hg/strip-backup/*-backup.hg (glob)
 
   $ hg --config diff.git=yes export 0
   # HG changeset patch
--- a/tests/test-histedit-fold.t	Sat Jul 08 16:50:31 2017 -0700
+++ b/tests/test-histedit-fold.t	Sat Jul 08 16:50:31 2017 -0700
@@ -382,8 +382,7 @@
   HG: user: test
   HG: branch 'default'
   HG: changed file
-  saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/55c8d8dc79ce-4066cd98-backup.hg (glob)
-  saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-a35700fc-backup.hg (glob)
+  saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-3d69522c-backup.hg (glob)
   $ hg logt -G
   @  1:10c647b2cdd5 +4
   |
--- a/tests/test-histedit-obsolete.t	Sat Jul 08 16:50:31 2017 -0700
+++ b/tests/test-histedit-obsolete.t	Sat Jul 08 16:50:31 2017 -0700
@@ -170,13 +170,13 @@
   o  0:cb9a9f314b8b a
   
   $ hg debugobsolete
-  96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 {b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (*) {'user': 'test'} (glob)
-  b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 {96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (*) {'user': 'test'} (glob)
   d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 {cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (*) {'user': 'test'} (glob)
   177f92b773850b59254aa5e923436f921b55483b b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (*) {'user': 'test'} (glob)
   055a42cdd88768532f9cf79daa407fc8d138de9b 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (*) {'user': 'test'} (glob)
   e860deea161a2f77de56603b340ebbb4536308ae 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (*) {'user': 'test'} (glob)
   652413bf663ef2a641cab26574e46d5f5a64a55a cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (*) {'user': 'test'} (glob)
+  96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 {b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (*) {'user': 'test'} (glob)
+  b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 {96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (*) {'user': 'test'} (glob)
 
 
 Ensure hidden revision does not prevent histedit