# HG changeset patch # User Martin von Zweigbergk # Date 1453246627 28800 # Node ID 1289a122cf3f55ed8c37be11157fe8acf06abfe5 # Parent 7cbb3a01fa38190d986741117a867a2e8586c668 shelve: use cg3 for treemanifests Similar to previous change, this teaches shelve to pick the right changegroup version for repos that use treemanifests. diff -r 7cbb3a01fa38 -r 1289a122cf3f hgext/shelve.py --- a/hgext/shelve.py Tue Jan 19 15:38:24 2016 -0800 +++ b/hgext/shelve.py Tue Jan 19 15:37:07 2016 -0800 @@ -112,12 +112,12 @@ return bundlerepo.bundlerepository(self.repo.baseui, self.repo.root, self.vfs.join(self.fname)) def writebundle(self, bases, node): - btype = 'HG10BZ' - cgversion = '01' - compression = None - if 'generaldelta' in self.repo.requirements: + cgversion = changegroup.safeversion(self.repo) + if cgversion == '01': + btype = 'HG10BZ' + compression = None + else: btype = 'HG20' - cgversion = '02' compression = 'BZ' cg = changegroup.changegroupsubset(self.repo, bases, [node], 'shelve', diff -r 7cbb3a01fa38 -r 1289a122cf3f mercurial/changegroup.py --- a/mercurial/changegroup.py Tue Jan 19 15:38:24 2016 -0800 +++ b/mercurial/changegroup.py Tue Jan 19 15:37:07 2016 -0800 @@ -963,7 +963,8 @@ def safeversion(repo): # Finds the smallest version that it's safe to assume clients of the repo - # will support. + # will support. For example, all hg versions that support generaldelta also + # support changegroup 02. versions = supportedversions(repo) if 'generaldelta' in repo.requirements: versions.discard('01') diff -r 7cbb3a01fa38 -r 1289a122cf3f tests/test-treemanifest.t --- a/tests/test-treemanifest.t Tue Jan 19 15:38:24 2016 -0800 +++ b/tests/test-treemanifest.t Tue Jan 19 15:37:07 2016 -0800 @@ -296,6 +296,22 @@ $ hg st --change tip M dir1/a +Shelving and unshelving should work + + $ echo foo >> dir1/a + $ hg --config extensions.shelve= shelve + shelved as default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --config extensions.shelve= unshelve + unshelving change 'default' + $ hg diff --nodates + diff -r 708a273da119 dir1/a + --- a/dir1/a + +++ b/dir1/a + @@ -1,1 +1,2 @@ + 1 + +foo + Create deeper repo with tree manifests. $ cd ..