strip: be quiet about temporary internal bundle

This commit is contained in:
Matt Mackall 2010-05-19 19:46:39 -05:00
parent b68b0fc427
commit 0a1ca665ca
22 changed files with 37 additions and 72 deletions

View File

@ -18,7 +18,6 @@ def _bundle(repo, bases, heads, node, suffix, extranodes=None):
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 @@ def strip(ui, repo, node, backup="all"):
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 @@ def strip(ui, repo, node, backup="all"):
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:
for i in xrange(offset, len(tr.entries)):
file, troffset, ignore = tr.entries[i]
repo.sopener(file, 'a').truncate(troffset)
tr.close()
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()
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()

View File

@ -9,7 +9,6 @@ adding d
* two 3:2ae46b1d99a7
one 1:925d80f479bb
% rebase
saving bundle to
adding branch
adding changesets
adding manifests

View File

@ -13,7 +13,6 @@ created new head
test2 1:16b24da7e457
% strip to revision 1
saving bundle to
saving bundle to
adding branch
adding changesets
adding manifests

View File

@ -271,7 +271,6 @@ diff -r 000000000000 b
+a
% issue2025: qrefresh does not honor filtering options when tip != qtip
% refresh with tip != qtip
saving bundle...
adding branch
adding changesets
adding manifests

View File

@ -84,7 +84,6 @@ user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: e
saving bundle to
saving bundle to
adding branch
adding changesets

View File

@ -530,7 +530,6 @@ summary: add foo
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
saving bundle to
saving bundle to
adding branch
adding changesets
adding manifests

View File

@ -32,7 +32,6 @@ default 0:1994f17a630e (inactive)
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 7:33c9da881988 Branch3 branch: branch3
|/
o 0:1994f17a630e A branch:
saving bundle to
adding branch
adding changesets
adding manifests
@ -149,7 +147,6 @@ o 7:33c9da881988 Branch3 branch: branch3
|/
o 0:1994f17a630e A branch:
saving bundle to
adding branch
adding changesets
adding manifests

View File

@ -55,7 +55,6 @@ merging A failed!
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

View File

@ -16,7 +16,6 @@ o 0: A
% 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 @@ F
H
% Rebasing G onto H
saving bundle to
adding branch
adding changesets
adding manifests
@ -95,7 +93,6 @@ o 0: A
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 @@ o 0: A
% Rebase and collapse - E onto I
merging E
saving bundle to
adding branch
adding changesets
adding manifests
@ -191,7 +187,6 @@ o 0: A
% Rebase and collapse - B onto F
saving bundle to
adding branch
adding changesets
adding manifests

View File

@ -26,7 +26,6 @@ abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
abort: unresolved merge conflicts (see hg resolve)
% Conclude rebase
saving bundle to
adding branch
adding changesets
adding manifests

View File

@ -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 @@ E
o 0: A
% Rebasing C onto E detaching from B
saving bundle to
adding branch
adding changesets
adding manifests
@ -76,7 +74,6 @@ E
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 @@ E
o 0: A
% Rebasing C onto E detaching from B and collapsing
saving bundle to
adding branch
adding changesets
adding manifests

View File

@ -13,7 +13,6 @@ o 0:c1
% 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 @@ o 0:c1
% 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

View File

@ -13,7 +13,6 @@ o 0:c1:
% 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

View File

@ -6,7 +6,6 @@ applying p1.patch
% Rebase
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
saving bundle to
adding branch
adding changesets
adding manifests

View File

@ -27,7 +27,6 @@ merging f failed!
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 @@ diff -r x p
+mq2
% Rebase the applied mq patches
saving bundle to
% And the patches are correct
% Git patch
# HG changeset patch

View File

@ -267,7 +267,6 @@ nothing to rebase
% 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 @@ no rollback information available
% 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 completed
% 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 @@ added 5 changesets with 5 changes to 5 files
rebase completed
% Specify only source (from 4 onto 7)
saving bundle to
adding branch
adding changesets
adding manifests
@ -308,7 +304,6 @@ rebase completed
% 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 @@ added 5 changesets with 5 changes to 5 files (+1 heads)
rebase completed
% Specify only base (from 3 onto 7)
saving bundle to
adding branch
adding changesets
adding manifests
@ -326,7 +320,6 @@ added 5 changesets with 5 changes to 5 files
rebase completed
% Specify source and dest (from 4 onto 6)
saving bundle to
adding branch
adding changesets
adding manifests
@ -335,7 +328,6 @@ added 4 changesets with 4 changes to 4 files
rebase completed
% Specify base and dest (from 3 onto 6)
saving bundle to
adding branch
adding changesets
adding manifests

View File

@ -10,7 +10,6 @@ adding changesets
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

View File

@ -10,7 +10,6 @@ rename from a
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 from a
copy to a-copied
% Rebase the revision containing the copy
saving bundle to
% Copy is not lost
2:copy A

View File

@ -12,7 +12,6 @@ o 0: A
% Rebasing
% B onto F - simple rebase
saving bundle to
adding branch
adding changesets
adding manifests
@ -32,7 +31,6 @@ o | 2: D
o 0: A
% B onto D - intermediate point
saving bundle to
adding branch
adding changesets
adding manifests
@ -52,7 +50,6 @@ o | 2: D
o 0: A
% C onto F - skip of E
saving bundle to
adding branch
adding changesets
adding manifests
@ -70,7 +67,6 @@ o 2: D
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 2: C
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 | 2: C
o 0: A
% D onto B - E maintains C as parent
saving bundle to
adding branch
adding changesets
adding manifests

View File

@ -8,7 +8,7 @@ teststrip() {
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

View File

@ -4,10 +4,11 @@ user: test
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 @@ user: test
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

View File

@ -49,7 +49,6 @@ crossed/.hg/store/data/manifest-file.i
% 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 @@ checking files
% 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 @@ checking files
% 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 @@ checking files
% 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