[PATCH 4 of 4] strip: don't use "full" and "partial" to describe bundles

Martin von Zweigbergk martinvonz at google.com
Mon Sep 19 13:30:24 EDT 2016


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1474301675 25200
#      Mon Sep 19 09:14:35 2016 -0700
# Node ID e2690139bf38a77e6308eb8f6cb9efe17a9b5f59
# Parent  00910394ea13a94631ea1ba35bedb954e18451dc
strip: don't use "full" and "partial" to describe bundles

The partial bundle is not a subset of the full bundle, and the full
bundle is not full in any way that i see. The most obvious
interpretation of "full" I can think of is that it has all commits
back to the null revision, but that is not what the "full" bundle
is. The "full" bundle is simply a backup of what the user asked us to
strip (unless --no-backup). The "partial" bundle contains the
revisions we temporarily stripped because they had higher revision
numbers that some commit that the user asked us to strip.

The "full" bundle is already called "backup" in the code, so let's use
that in user-facing messages too. Let's call the "partial" bundle
"temporary" in the code.

diff -r 00910394ea13 -r e2690139bf38 mercurial/repair.py
--- a/mercurial/repair.py	Mon Sep 19 09:14:32 2016 -0700
+++ b/mercurial/repair.py	Mon Sep 19 09:14:35 2016 -0700
@@ -147,10 +147,10 @@
                        vfs.join(backupfile))
         repo.ui.log("backupbundle", "saved backup bundle to %s\n",
                     vfs.join(backupfile))
-    chgrpfile = None
+    tmpbundlefile = None
     if saveheads:
-        # do not compress partial bundle if we remove it from disk later
-        chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp',
+        # do not compress temporary bundle if we remove it from disk later
+        tmpbundlefile = _bundle(repo, savebases, saveheads, node, 'temp',
                             compress=False)
 
     mfst = repo.manifest
@@ -185,21 +185,22 @@
                 if troffset == 0:
                     repo.store.markremoved(file)
 
-        if chgrpfile:
+        if tmpbundlefile:
             ui.note(_("adding branch\n"))
-            f = vfs.open(chgrpfile, "rb")
-            gen = exchange.readbundle(ui, f, chgrpfile, vfs)
+            f = vfs.open(tmpbundlefile, "rb")
+            gen = exchange.readbundle(ui, f, tmpbundlefile, vfs)
             if not repo.ui.verbose:
                 # silence internal shuffling chatter
                 repo.ui.pushbuffer()
             if isinstance(gen, bundle2.unbundle20):
                 with repo.transaction('strip') as tr:
                     tr.hookargs = {'source': 'strip',
-                                   'url': 'bundle:' + vfs.join(chgrpfile)}
+                                   'url': 'bundle:' + vfs.join(tmpbundlefile)}
                     bundle2.applybundle(repo, gen, tr, source='strip',
-                                        url='bundle:' + vfs.join(chgrpfile))
+                                        url='bundle:' + vfs.join(tmpbundlefile))
             else:
-                gen.apply(repo, 'strip', 'bundle:' + vfs.join(chgrpfile), True)
+                gen.apply(repo, 'strip', 'bundle:' + vfs.join(tmpbundlefile),
+                          True)
             if not repo.ui.verbose:
                 repo.ui.popbuffer()
             f.close()
@@ -228,18 +229,18 @@
 
     except: # re-raises
         if backupfile:
-            ui.warn(_("strip failed, full bundle stored in '%s'\n")
+            ui.warn(_("strip failed, backup bundle stored in '%s'\n")
                     % vfs.join(backupfile))
-        if chgrpfile:
+        if tmpbundlefile:
             ui.warn(_("strip failed, unrecovered changes stored in '%s'\n")
-                    % vfs.join(chgrpfile))
+                    % vfs.join(tmpbundlefile))
             ui.warn(_("(fix the problem, then recover the changesets with "
-                      "\"hg unbundle '%s'\")\n") % vfs.join(chgrpfile))
+                      "\"hg unbundle '%s'\")\n") % vfs.join(tmpbundlefile))
         raise
     else:
-        if chgrpfile:
-            # Remove partial backup only if there were no exceptions
-            vfs.unlink(chgrpfile)
+        if tmpbundlefile:
+            # Remove temporary bundle only if there were no exceptions
+            vfs.unlink(tmpbundlefile)
 
     repo.destroyed()
 
diff -r 00910394ea13 -r e2690139bf38 tests/test-hook.t
--- a/tests/test-hook.t	Mon Sep 19 09:14:32 2016 -0700
+++ b/tests/test-hook.t	Mon Sep 19 09:14:35 2016 -0700
@@ -802,7 +802,7 @@
   saved backup bundle to * (glob)
   transaction abort!
   rollback completed
-  strip failed, full bundle stored in * (glob)
+  strip failed, backup bundle stored in * (glob)
   abort: pretxnclose.error hook exited with status 1
   [255]
   $ hg recover
diff -r 00910394ea13 -r e2690139bf38 tests/test-repair-strip.t
--- a/tests/test-repair-strip.t	Mon Sep 19 09:14:32 2016 -0700
+++ b/tests/test-repair-strip.t	Mon Sep 19 09:14:35 2016 -0700
@@ -51,7 +51,7 @@
   transaction abort!
   failed to truncate data/b.i
   rollback failed - please run hg recover
-  strip failed, full bundle
+  strip failed, backup bundle
   abort: Permission denied .hg/store/data/b.i
   % after update 0, strip 2
   abandoned transaction found - run hg recover
@@ -104,7 +104,7 @@
   transaction abort!
   failed to truncate 00manifest.i
   rollback failed - please run hg recover
-  strip failed, full bundle
+  strip failed, backup bundle
   abort: Permission denied .hg/store/00manifest.i
   % after update 0, strip 2
   abandoned transaction found - run hg recover
diff -r 00910394ea13 -r e2690139bf38 tests/test-strip.t
--- a/tests/test-strip.t	Mon Sep 19 09:14:32 2016 -0700
+++ b/tests/test-strip.t	Mon Sep 19 09:14:35 2016 -0700
@@ -374,7 +374,7 @@
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
   transaction abort!
   rollback completed
-  strip failed, full bundle stored in '$TESTTMP/test/.hg/strip-backup/*-backup.hg' (glob)
+  strip failed, backup bundle stored in '$TESTTMP/test/.hg/strip-backup/*-backup.hg' (glob)
   strip failed, unrecovered changes stored in '$TESTTMP/test/.hg/strip-backup/*-temp.hg' (glob)
   (fix the problem, then recover the changesets with "hg unbundle '$TESTTMP/test/.hg/strip-backup/*-temp.hg'") (glob)
   abort: pretxnchangegroup.bad hook exited with status 1
@@ -931,7 +931,7 @@
   > EOF
   $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
   saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob)
-  strip failed, full bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' (glob)
+  strip failed, backup bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' (glob)
   abort: boom
   [255]
 


More information about the Mercurial-devel mailing list