Mercurial > hg
changeset 26507:ae29cffa05db
shelve: bundle using bundle2 if repository is general delta (issue4862)
This will prevent expensive delta computation on bundling and is similar to what we do
for strip backup.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 01 Oct 2015 15:08:00 -0700 |
parents | edecf059fda6 |
children | 47a12de9ac3f |
files | hgext/shelve.py tests/test-shelve.t |
diffstat | 2 files changed, 58 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/shelve.py Thu Oct 01 15:09:32 2015 -0700 +++ b/hgext/shelve.py Thu Oct 01 15:08:00 2015 -0700 @@ -106,8 +106,18 @@ return bundlerepo.bundlerepository(self.repo.baseui, self.repo.root, self.vfs.join(self.fname)) def writebundle(self, bases, node): - cg = changegroup.changegroupsubset(self.repo, bases, [node], 'shelve') - changegroup.writebundle(self.ui, cg, self.fname, 'HG10BZ', self.vfs) + btype = 'HG10BZ' + cgversion = '01' + compression = None + if 'generaldelta' in self.repo.requirements: + btype = 'HG20' + cgversion = '02' + compression = 'BZ' + + cg = changegroup.changegroupsubset(self.repo, bases, [node], 'shelve', + version=cgversion) + changegroup.writebundle(self.ui, cg, self.fname, btype, self.vfs, + compression=compression) class shelvedstate(object): """Handle persistence during unshelving operations.
--- a/tests/test-shelve.t Thu Oct 01 15:09:32 2015 -0700 +++ b/tests/test-shelve.t Thu Oct 01 15:08:00 2015 -0700 @@ -954,3 +954,49 @@ abort: cannot find shelf nonexistentshelf [255] + $ cd .. + +Shelve from general delta repo uses bundle2 on disk +-------------------------------------------------- + +no general delta + + $ hg clone --pull repo bundle1 --config format.generaldelta=0 + requesting all changes + adding changesets + adding manifests + adding file changes + added 5 changesets with 8 changes to 6 files + updating to branch default + 6 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd bundle1 + $ echo babar > jungle + $ hg add jungle + $ hg shelve + shelved as default + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg debugbundle .hg/shelved/*.hg + 7e30d8ac6f23cfc84330fd7e698730374615d21a + $ cd .. + +with general delta + + $ hg clone --pull repo bundle2 --config format.generaldelta=1 + requesting all changes + adding changesets + adding manifests + adding file changes + added 5 changesets with 8 changes to 6 files + updating to branch default + 6 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd bundle2 + $ echo babar > jungle + $ hg add jungle + $ hg shelve + shelved as default + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg debugbundle .hg/shelved/*.hg + Stream params: {'Compression': 'BZ'} + changegroup -- "{'version': '02'}" + 7e30d8ac6f23cfc84330fd7e698730374615d21a + $ cd ..