mirror of
https://github.com/facebook/sapling.git
synced 2024-12-29 08:02:24 +03:00
bundle: when verbose, show what takes up the space in the generated bundle
This is kind of similar to the debugbundle command but gives summarized actual uncompressed number of bytes when creating the bundle. The numbers are as usable as the bundle format is efficient. Hopefully bundle2 will make it a better indicator of actual entropy. This is useful when accepting pull requests to assess whether the repo size increase seems reasonable for the diff before pushing stuff upstream, It has helped me catching large files that should have been committed as largefiles but was committed as regular files in intermediate changesets. This output doesn't combine well with debug output so we only enable it when verbose without debug.
This commit is contained in:
parent
e1de1d2c0d
commit
af8710d713
@ -258,6 +258,11 @@ class cg1packer(object):
|
|||||||
self._repo = repo
|
self._repo = repo
|
||||||
self._reorder = reorder
|
self._reorder = reorder
|
||||||
self._progress = repo.ui.progress
|
self._progress = repo.ui.progress
|
||||||
|
if self._repo.ui.verbose and not self._repo.ui.debugflag:
|
||||||
|
self._verbosenote = self._repo.ui.note
|
||||||
|
else:
|
||||||
|
self._verbosenote = lambda s: None
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
return closechunk()
|
return closechunk()
|
||||||
|
|
||||||
@ -341,9 +346,13 @@ class cg1packer(object):
|
|||||||
mfs.setdefault(c[0], x)
|
mfs.setdefault(c[0], x)
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
self._verbosenote(_('uncompressed size of bundle content:\n'))
|
||||||
|
size = 0
|
||||||
for chunk in self.group(clnodes, cl, lookupcl, units=_('changesets'),
|
for chunk in self.group(clnodes, cl, lookupcl, units=_('changesets'),
|
||||||
reorder=reorder):
|
reorder=reorder):
|
||||||
|
size += len(chunk)
|
||||||
yield chunk
|
yield chunk
|
||||||
|
self._verbosenote(_('%8.i (changelog)\n') % size)
|
||||||
progress(msgbundling, None)
|
progress(msgbundling, None)
|
||||||
|
|
||||||
# Callback for the manifest, used to collect linkrevs for filelog
|
# Callback for the manifest, used to collect linkrevs for filelog
|
||||||
@ -364,9 +373,12 @@ class cg1packer(object):
|
|||||||
return clnode
|
return clnode
|
||||||
|
|
||||||
mfnodes = self.prune(mf, mfs, commonrevs, source)
|
mfnodes = self.prune(mf, mfs, commonrevs, source)
|
||||||
|
size = 0
|
||||||
for chunk in self.group(mfnodes, mf, lookupmf, units=_('manifests'),
|
for chunk in self.group(mfnodes, mf, lookupmf, units=_('manifests'),
|
||||||
reorder=reorder):
|
reorder=reorder):
|
||||||
|
size += len(chunk)
|
||||||
yield chunk
|
yield chunk
|
||||||
|
self._verbosenote(_('%8.i (manifests)\n') % size)
|
||||||
progress(msgbundling, None)
|
progress(msgbundling, None)
|
||||||
|
|
||||||
mfs.clear()
|
mfs.clear()
|
||||||
@ -417,10 +429,14 @@ class cg1packer(object):
|
|||||||
if filenodes:
|
if filenodes:
|
||||||
progress(msgbundling, i + 1, item=fname, unit=msgfiles,
|
progress(msgbundling, i + 1, item=fname, unit=msgfiles,
|
||||||
total=total)
|
total=total)
|
||||||
yield self.fileheader(fname)
|
h = self.fileheader(fname)
|
||||||
|
size = len(h)
|
||||||
|
yield h
|
||||||
for chunk in self.group(filenodes, filerevlog, lookupfilelog,
|
for chunk in self.group(filenodes, filerevlog, lookupfilelog,
|
||||||
reorder=reorder):
|
reorder=reorder):
|
||||||
|
size += len(chunk)
|
||||||
yield chunk
|
yield chunk
|
||||||
|
self._verbosenote(_('%8.i %s\n') % (size, fname))
|
||||||
|
|
||||||
def deltaparent(self, revlog, rev, p1, p2, prev):
|
def deltaparent(self, revlog, rev, p1, p2, prev):
|
||||||
return prev
|
return prev
|
||||||
|
@ -109,8 +109,16 @@ No changes, just a different message:
|
|||||||
a
|
a
|
||||||
stripping amended changeset 74609c7f506e
|
stripping amended changeset 74609c7f506e
|
||||||
1 changesets found
|
1 changesets found
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
250 (changelog)
|
||||||
|
143 (manifests)
|
||||||
|
109 a
|
||||||
saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-amend-backup.hg (glob)
|
saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-amend-backup.hg (glob)
|
||||||
1 changesets found
|
1 changesets found
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
246 (changelog)
|
||||||
|
143 (manifests)
|
||||||
|
109 a
|
||||||
adding branch
|
adding branch
|
||||||
adding changesets
|
adding changesets
|
||||||
adding manifests
|
adding manifests
|
||||||
@ -236,8 +244,16 @@ then, test editing custom commit message
|
|||||||
a
|
a
|
||||||
stripping amended changeset 5f357c7560ab
|
stripping amended changeset 5f357c7560ab
|
||||||
1 changesets found
|
1 changesets found
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
238 (changelog)
|
||||||
|
143 (manifests)
|
||||||
|
111 a
|
||||||
saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-amend-backup.hg (glob)
|
saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-amend-backup.hg (glob)
|
||||||
1 changesets found
|
1 changesets found
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
246 (changelog)
|
||||||
|
143 (manifests)
|
||||||
|
111 a
|
||||||
adding branch
|
adding branch
|
||||||
adding changesets
|
adding changesets
|
||||||
adding manifests
|
adding manifests
|
||||||
@ -265,8 +281,16 @@ Same, but with changes in working dir (different code path):
|
|||||||
stripping intermediate changeset a0ea9b1a4c8c
|
stripping intermediate changeset a0ea9b1a4c8c
|
||||||
stripping amended changeset 7ab3bf440b54
|
stripping amended changeset 7ab3bf440b54
|
||||||
2 changesets found
|
2 changesets found
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
450 (changelog)
|
||||||
|
282 (manifests)
|
||||||
|
209 a
|
||||||
saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-amend-backup.hg (glob)
|
saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-amend-backup.hg (glob)
|
||||||
1 changesets found
|
1 changesets found
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
246 (changelog)
|
||||||
|
143 (manifests)
|
||||||
|
113 a
|
||||||
adding branch
|
adding branch
|
||||||
adding changesets
|
adding changesets
|
||||||
adding manifests
|
adding manifests
|
||||||
|
@ -6,8 +6,13 @@ Create a test repository:
|
|||||||
$ touch a ; hg add a ; hg ci -ma
|
$ touch a ; hg add a ; hg ci -ma
|
||||||
$ touch b ; hg add b ; hg ci -mb
|
$ touch b ; hg add b ; hg ci -mb
|
||||||
$ touch c ; hg add c ; hg ci -mc
|
$ touch c ; hg add c ; hg ci -mc
|
||||||
$ hg bundle --base 0 --rev tip bundle.hg
|
$ hg bundle --base 0 --rev tip bundle.hg -v
|
||||||
2 changesets found
|
2 changesets found
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
332 (changelog)
|
||||||
|
282 (manifests)
|
||||||
|
105 b
|
||||||
|
105 c
|
||||||
|
|
||||||
Terse output:
|
Terse output:
|
||||||
|
|
||||||
|
@ -1097,6 +1097,17 @@ redo pull with --lfrev and check it pulls largefiles for the right revs
|
|||||||
all local heads known remotely
|
all local heads known remotely
|
||||||
6 changesets found
|
6 changesets found
|
||||||
adding changesets
|
adding changesets
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
1213 (changelog)
|
||||||
|
1479 (manifests)
|
||||||
|
234 .hglf/large1
|
||||||
|
504 .hglf/large3
|
||||||
|
512 .hglf/sub/large4
|
||||||
|
162 .hglf/sub2/large6
|
||||||
|
162 .hglf/sub2/large7
|
||||||
|
192 normal1
|
||||||
|
397 normal3
|
||||||
|
405 sub/normal4
|
||||||
adding manifests
|
adding manifests
|
||||||
adding file changes
|
adding file changes
|
||||||
added 6 changesets with 16 changes to 8 files
|
added 6 changesets with 16 changes to 8 files
|
||||||
|
@ -764,6 +764,10 @@ Bare push with next changeset and common changeset needing sync (issue3575)
|
|||||||
pushing to ../alpha
|
pushing to ../alpha
|
||||||
searching for changes
|
searching for changes
|
||||||
1 changesets found
|
1 changesets found
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
172 (changelog)
|
||||||
|
145 (manifests)
|
||||||
|
111 a-H
|
||||||
adding changesets
|
adding changesets
|
||||||
adding manifests
|
adding manifests
|
||||||
adding file changes
|
adding file changes
|
||||||
|
@ -142,6 +142,10 @@
|
|||||||
pushing to ../c
|
pushing to ../c
|
||||||
searching for changes
|
searching for changes
|
||||||
2 changesets found
|
2 changesets found
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
308 (changelog)
|
||||||
|
286 (manifests)
|
||||||
|
213 foo
|
||||||
adding changesets
|
adding changesets
|
||||||
adding manifests
|
adding manifests
|
||||||
adding file changes
|
adding file changes
|
||||||
|
@ -64,8 +64,18 @@ already has one local mq patch
|
|||||||
updating mq patch p0.patch to 5:9ecc820b1737
|
updating mq patch p0.patch to 5:9ecc820b1737
|
||||||
$TESTTMP/a/.hg/patches/p0.patch (glob)
|
$TESTTMP/a/.hg/patches/p0.patch (glob)
|
||||||
2 changesets found
|
2 changesets found
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
344 (changelog)
|
||||||
|
284 (manifests)
|
||||||
|
109 p0
|
||||||
|
109 p1
|
||||||
saved backup bundle to $TESTTMP/a/.hg/strip-backup/13a46ce44f60-backup.hg (glob)
|
saved backup bundle to $TESTTMP/a/.hg/strip-backup/13a46ce44f60-backup.hg (glob)
|
||||||
2 changesets found
|
2 changesets found
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
399 (changelog)
|
||||||
|
284 (manifests)
|
||||||
|
109 p0
|
||||||
|
109 p1
|
||||||
adding branch
|
adding branch
|
||||||
adding changesets
|
adding changesets
|
||||||
adding manifests
|
adding manifests
|
||||||
|
@ -294,8 +294,16 @@ rebase of merge of ancestors
|
|||||||
other
|
other
|
||||||
rebase merging completed
|
rebase merging completed
|
||||||
1 changesets found
|
1 changesets found
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
193 (changelog)
|
||||||
|
196 (manifests)
|
||||||
|
162 other
|
||||||
saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/4c5f12f25ebe-backup.hg (glob)
|
saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/4c5f12f25ebe-backup.hg (glob)
|
||||||
1 changesets found
|
1 changesets found
|
||||||
|
uncompressed size of bundle content:
|
||||||
|
252 (changelog)
|
||||||
|
147 (manifests)
|
||||||
|
162 other
|
||||||
adding branch
|
adding branch
|
||||||
adding changesets
|
adding changesets
|
||||||
adding manifests
|
adding manifests
|
||||||
|
Loading…
Reference in New Issue
Block a user