strip: be quiet about temporary internal bundle
authorMatt Mackall <mpm@selenic.com>
Wed, 19 May 2010 19:46:39 -0500
changeset 11197 4bb4895e1693
parent 11196 573bef78763f
child 11198 b345b1cc124f
strip: be quiet about temporary internal bundle
mercurial/repair.py
tests/test-bookmarks-rebase.out
tests/test-bookmarks-strip.out
tests/test-mq-qrefresh.out
tests/test-mq-strip.out
tests/test-mq.out
tests/test-rebase-cache.out
tests/test-rebase-check-restore.out
tests/test-rebase-collapse.out
tests/test-rebase-conflicts.out
tests/test-rebase-detach.out
tests/test-rebase-issue-noparam-single-rev.out
tests/test-rebase-keep-branch.out
tests/test-rebase-mq-skip.out
tests/test-rebase-mq.out
tests/test-rebase-parameters.out
tests/test-rebase-pull.out
tests/test-rebase-rename.out
tests/test-rebase-scenario-global.out
tests/test-repair-strip
tests/test-repair-strip.out
tests/test-strip-cross.out
--- a/mercurial/repair.py	Wed May 19 22:32:40 2010 +0200
+++ b/mercurial/repair.py	Wed May 19 19:46:39 2010 -0500
@@ -18,7 +18,6 @@
     if not os.path.isdir(backupdir):
         os.mkdir(backupdir)
     name = os.path.join(backupdir, "%s-%s" % (short(node), suffix))
-    repo.ui.warn(_("saving bundle to %s\n") % name)
     return changegroup.writebundle(cg, name, "HG10BZ")
 
 def _collectfiles(repo, striprev):
@@ -106,8 +105,10 @@
     extranodes = _collectextranodes(repo, files, striprev)
 
     # create a changegroup for all the branches we need to keep
+    backupfile = None
     if backup == "all":
-        _bundle(repo, [node], cl.heads(), node, 'backup')
+        backupfile = _bundle(repo, [node], cl.heads(), node, 'backup')
+        repo.ui.status(_("saving bundle to %s\n") % backupfile)
     if saveheads or extranodes:
         chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp',
                             extranodes)
@@ -117,29 +118,37 @@
     tr = repo.transaction("strip")
     offset = len(tr.entries)
 
-    tr.startgroup()
-    cl.strip(striprev, tr)
-    mfst.strip(striprev, tr)
-    for fn in files:
-        repo.file(fn).strip(striprev, tr)
-    tr.endgroup()
+    try:
+        tr.startgroup()
+        cl.strip(striprev, tr)
+        mfst.strip(striprev, tr)
+        for fn in files:
+            repo.file(fn).strip(striprev, tr)
+        tr.endgroup()
 
-    try:
-        for i in xrange(offset, len(tr.entries)):
-            file, troffset, ignore = tr.entries[i]
-            repo.sopener(file, 'a').truncate(troffset)
-        tr.close()
+        try:
+            for i in xrange(offset, len(tr.entries)):
+                file, troffset, ignore = tr.entries[i]
+                repo.sopener(file, 'a').truncate(troffset)
+            tr.close()
+        except:
+            tr.abort()
+            raise
+
+        if saveheads or extranodes:
+            ui.status(_("adding branch\n"))
+            f = open(chgrpfile, "rb")
+            gen = changegroup.readbundle(f, chgrpfile)
+            repo.addchangegroup(gen, 'strip', 'bundle:' + chgrpfile, True)
+            f.close()
+            if backup != "strip":
+                os.unlink(chgrpfile)
     except:
-        tr.abort()
+        if backupfile:
+            ui.warn("strip failed, full bundle stored in '%s'\n" % backupfile)
+        elif saveheads:
+            ui.warn("strip failed, partial bundle stored in '%s'\n"
+                    % chgrpfile)
         raise
 
-    if saveheads or extranodes:
-        ui.status(_("adding branch\n"))
-        f = open(chgrpfile, "rb")
-        gen = changegroup.readbundle(f, chgrpfile)
-        repo.addchangegroup(gen, 'strip', 'bundle:' + chgrpfile, True)
-        f.close()
-        if backup != "strip":
-            os.unlink(chgrpfile)
-
     repo.destroyed()
--- a/tests/test-bookmarks-rebase.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-bookmarks-rebase.out	Wed May 19 19:46:39 2010 -0500
@@ -9,7 +9,6 @@
  * two                       3:2ae46b1d99a7
    one                       1:925d80f479bb
 % rebase
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-bookmarks-strip.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-bookmarks-strip.out	Wed May 19 19:46:39 2010 -0500
@@ -13,7 +13,6 @@
    test2                     1:16b24da7e457
 % strip to revision 1
 saving bundle to 
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-mq-qrefresh.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-mq-qrefresh.out	Wed May 19 19:46:39 2010 -0500
@@ -271,7 +271,6 @@
 +a
 % issue2025: qrefresh does not honor filtering options when tip != qtip
 % refresh with tip != qtip
-saving bundle...
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-mq-strip.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-mq-strip.out	Wed May 19 19:46:39 2010 -0500
@@ -85,7 +85,6 @@
 summary:     e
 
 saving bundle to 
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-mq.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-mq.out	Wed May 19 19:46:39 2010 -0500
@@ -530,7 +530,6 @@
 
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 saving bundle to 
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-rebase-cache.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-rebase-cache.out	Wed May 19 19:46:39 2010 -0500
@@ -32,7 +32,6 @@
 0:1994f17a630e A branch: 
 
 % Rebase part of branch2 (5-6) onto branch3 (8)
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -90,7 +89,6 @@
 |/
 o  0:1994f17a630e A branch:
 
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -149,7 +147,6 @@
 |/
 o  0:1994f17a630e A branch:
 
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-rebase-check-restore.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-rebase-check-restore.out	Wed May 19 19:46:39 2010 -0500
@@ -55,7 +55,6 @@
 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
 
 % - Solve the conflict and go on
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-rebase-collapse.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-rebase-collapse.out	Wed May 19 19:46:39 2010 -0500
@@ -16,7 +16,6 @@
 
 % Rebasing B onto H
 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -46,7 +45,6 @@
 H
 
 % Rebasing G onto H
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -95,7 +93,6 @@
 abort: unable to collapse, there is more than one external parent
 
 % Rebase and collapse - E onto H
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -145,7 +142,6 @@
 
 % Rebase and collapse - E onto I
 merging E
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -191,7 +187,6 @@
 
 
 % Rebase and collapse - B onto F
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-rebase-conflicts.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-rebase-conflicts.out	Wed May 19 19:46:39 2010 -0500
@@ -26,7 +26,6 @@
 abort: unresolved merge conflicts (see hg resolve)
 
 % Conclude rebase
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-rebase-detach.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-rebase-detach.out	Wed May 19 19:46:39 2010 -0500
@@ -9,7 +9,6 @@
 o  0: A
 
 % Rebasing D onto E detaching from C
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -42,7 +41,6 @@
 o  0: A
 
 % Rebasing C onto E detaching from B
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -76,7 +74,6 @@
 o  0: A
 
 % Rebasing B onto E using detach (same as not using it)
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -111,7 +108,6 @@
 o  0: A
 
 % Rebasing C onto E detaching from B and collapsing
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-rebase-issue-noparam-single-rev.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-rebase-issue-noparam-single-rev.out	Wed May 19 19:46:39 2010 -0500
@@ -13,7 +13,6 @@
 
 % Rebase with no arguments - single revision in source branch
 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -45,7 +44,6 @@
 
 % Rebase with no arguments - single revision in target branch
 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-rebase-keep-branch.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-rebase-keep-branch.out	Wed May 19 19:46:39 2010 -0500
@@ -13,7 +13,6 @@
 
 % Rebase a branch while preserving the branch name
 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-rebase-mq-skip.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-rebase-mq-skip.out	Wed May 19 19:46:39 2010 -0500
@@ -6,7 +6,6 @@
 
 % Rebase
 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-rebase-mq.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-rebase-mq.out	Wed May 19 19:46:39 2010 -0500
@@ -27,7 +27,6 @@
 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
 
 % Fix the 2nd conflict
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -107,7 +106,6 @@
 +mq2
 
 % Rebase the applied mq patches
-saving bundle to 
 % And the patches are correct
 % Git patch
 # HG changeset patch
--- a/tests/test-rebase-parameters.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-rebase-parameters.out	Wed May 19 19:46:39 2010 -0500
@@ -267,7 +267,6 @@
 
 % Rebase with no arguments (from 3 onto 7)
 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -279,7 +278,6 @@
 
 % Rebase with base == '.' => same as no arguments (from 3 onto 7)
 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -289,7 +287,6 @@
 
 % Rebase with dest == default => same as no arguments (from 3 onto 7)
 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -298,7 +295,6 @@
 rebase completed
 
 % Specify only source (from 4 onto 7)
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -308,7 +304,6 @@
 
 % Specify only dest (from 3 onto 6)
 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -317,7 +312,6 @@
 rebase completed
 
 % Specify only base (from 3 onto 7)
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -326,7 +320,6 @@
 rebase completed
 
 % Specify source and dest (from 4 onto 6)
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -335,7 +328,6 @@
 rebase completed
 
 % Specify base and dest (from 3 onto 6)
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-rebase-pull.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-rebase-pull.out	Wed May 19 19:46:39 2010 -0500
@@ -10,7 +10,6 @@
 adding manifests
 adding file changes
 added 1 changesets with 1 changes to 1 files (+1 heads)
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-rebase-rename.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-rebase-rename.out	Wed May 19 19:46:39 2010 -0500
@@ -10,7 +10,6 @@
 rename to a-renamed
 
 % Rebase the revision containing the rename
-saving bundle to 
 
 % Rename is not lost
 2:rename A
@@ -30,7 +29,6 @@
 copy to a-copied
 
 % Rebase the revision containing the copy
-saving bundle to 
 
 % Copy is not lost
 2:copy A
--- a/tests/test-rebase-scenario-global.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-rebase-scenario-global.out	Wed May 19 19:46:39 2010 -0500
@@ -12,7 +12,6 @@
 
 % Rebasing
 % B onto F - simple rebase
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -32,7 +31,6 @@
 o  0: A
 
 % B onto D - intermediate point
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -52,7 +50,6 @@
 o  0: A
 
 % C onto F - skip of E
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -70,7 +67,6 @@
 o  0: A
 
 % D onto C - rebase of a branching point (skip E)
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -88,7 +84,6 @@
 o  0: A
 
 % E onto F - merged revision having a parent in ancestors of target
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
@@ -108,7 +103,6 @@
 o  0: A
 
 % D onto B - E maintains C as parent
-saving bundle to 
 adding branch
 adding changesets
 adding manifests
--- a/tests/test-repair-strip	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-repair-strip	Wed May 19 19:46:39 2010 -0500
@@ -8,7 +8,7 @@
     echo % before update $1, strip $2
     hg parents
     chmod -$3 $4
-    hg strip $2 2>&1 | sed 's/\(saving bundle to \).*/\1/' | sed 's/Permission denied.*\.hg\/store\/\(.*\)/Permission denied \.hg\/store\/\1/'
+    hg strip $2 2>&1 | sed 's/\(bundle\).*/\1/' | sed 's/Permission denied.*\.hg\/store\/\(.*\)/Permission denied \.hg\/store\/\1/'
     echo % after update $1, strip $2
     chmod +$3 $4
     hg verify
--- a/tests/test-repair-strip.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-repair-strip.out	Wed May 19 19:46:39 2010 -0500
@@ -4,10 +4,11 @@
 date:        Thu Jan 01 00:00:00 1970 +0000
 summary:     a
 
-saving bundle to 
+saving bundle
 transaction abort!
 failed to truncate data/b.i
 rollback failed - please run hg recover
+strip failed, full bundle
 abort: Permission denied .hg/store/data/b.i
 % after update 0, strip 2
 abandoned transaction found - run hg recover
@@ -54,10 +55,11 @@
 date:        Thu Jan 01 00:00:00 1970 +0000
 summary:     a
 
-saving bundle to 
+saving bundle
 transaction abort!
 failed to truncate 00manifest.i
 rollback failed - please run hg recover
+strip failed, full bundle
 abort: Permission denied .hg/store/00manifest.i
 % after update 0, strip 2
 abandoned transaction found - run hg recover
--- a/tests/test-strip-cross.out	Wed May 19 22:32:40 2010 +0200
+++ b/tests/test-strip-cross.out	Wed May 19 19:46:39 2010 -0500
@@ -49,7 +49,6 @@
 
 % Trying to strip revision 0
 saving bundle to strip-backup/cbb8c2f0a2e3-backup
-saving bundle to strip-backup/cbb8c2f0a2e3-temp
 adding branch
 adding changesets
 adding manifests
@@ -64,7 +63,6 @@
 
 % Trying to strip revision 1
 saving bundle to strip-backup/124ecc0cbec9-backup
-saving bundle to strip-backup/124ecc0cbec9-temp
 adding branch
 adding changesets
 adding manifests
@@ -79,7 +77,6 @@
 
 % Trying to strip revision 2
 saving bundle to strip-backup/f6439b304a1a-backup
-saving bundle to strip-backup/f6439b304a1a-temp
 adding branch
 adding changesets
 adding manifests
@@ -94,7 +91,6 @@
 
 % Trying to strip revision 3
 saving bundle to strip-backup/6e54ec5db740-backup
-saving bundle to strip-backup/6e54ec5db740-temp
 adding branch
 adding changesets
 adding manifests