shelve: use cg3 for treemanifests
Similar to previous change, this teaches shelve to pick the right
changegroup version for repos that use treemanifests.
--- 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',
--- 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')
--- 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 ..