changeset 29954:769aee32fae0

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.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 19 Sep 2016 09:14:35 -0700
parents 94ebf56db04e
children 1b5931604a5a
files mercurial/repair.py tests/test-hook.t tests/test-repair-strip.t tests/test-strip.t
diffstat 4 files changed, 22 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- 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()
 
--- 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
--- 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
--- 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]