# HG changeset patch # User Martin von Zweigbergk # Date 2016-09-15 16:45:29 # Node ID 44ef21621ad7d0b5782cb3b016b70f0653fe75c2 # Parent e7acbe538bafc553733420c95b79772033ad71e2 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 --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -230,7 +230,7 @@ def strip(ui, repo, nodelist, backup=Tru 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 --git a/tests/test-strip.t b/tests/test-strip.t --- a/tests/test-strip.t +++ b/tests/test-strip.t @@ -367,11 +367,50 @@ 2 is parent of 3, only one strip should 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