[PATCH 2 of 4] strip: report both bundle files in case of exception (issue5368)

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


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1473957929 25200
#      Thu Sep 15 09:45:29 2016 -0700
# Node ID 83d10fef08a4f93da5bc4002cba6f610af66227a
# Parent  fcd760d062be51c78eaea0281bc253ce1022f09f
strip: report both bundle files in case of exception (issue5368)

If strip fails while recovering the temporary bundle (e.g. because a
hook fails), we tell the user only about the backup bundle, not about
the temporary bundle. Since the user did not ask to strip the commits
in the temporary bundle, that's the more important bundle to mention,
so let's do that (and also mention the backup bundle as usual).

diff -r fcd760d062be -r 83d10fef08a4 mercurial/repair.py
--- a/mercurial/repair.py	Thu Sep 15 10:18:56 2016 -0700
+++ b/mercurial/repair.py	Thu Sep 15 09:45:29 2016 -0700
@@ -230,7 +230,7 @@
         if backupfile:
             ui.warn(_("strip failed, full bundle stored in '%s'\n")
                     % vfs.join(backupfile))
-        elif chgrpfile:
+        if chgrpfile:
             ui.warn(_("strip failed, partial bundle stored in '%s'\n")
                     % vfs.join(chgrpfile))
         raise
diff -r fcd760d062be -r 83d10fef08a4 tests/test-strip.t
--- a/tests/test-strip.t	Thu Sep 15 10:18:56 2016 -0700
+++ b/tests/test-strip.t	Thu Sep 15 09:45:29 2016 -0700
@@ -367,11 +367,50 @@
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     a
   
+Failed hook while applying "saveheads" bundle.
+
+  $ hg strip 2 --config hooks.pretxnchangegroup.bad=false
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  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, partial bundle stored in '$TESTTMP/test/.hg/strip-backup/*-temp.hg' (glob)
+  abort: pretxnchangegroup.bad hook exited with status 1
+  [255]
+  $ restore
+  $ hg log -G
+  o  changeset:   4:443431ffac4f
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   3:65bd5f99a4a3
+  |  parent:      1:ef3a871183d7
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  | o  changeset:   2:264128213d29
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     c
+  |
+  @  changeset:   1:ef3a871183d7
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:9ab35a2d17cb
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
 
 2 different branches: 2 strips
 
   $ hg strip 2 4
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
   $ hg log -G
   o  changeset:   2:65bd5f99a4a3


More information about the Mercurial-devel mailing list