##// END OF EJS Templates
strip: use bundle2 + cg2 by default when repository use general delta...
Pierre-Yves David -
r26423:c93f91c1 default
parent child Browse files
Show More
@@ -21,18 +21,9 b' from . import ('
21 21
22 22 def _bundle(repo, bases, heads, node, suffix, compress=True):
23 23 """create a bundle with the specified revisions as a backup"""
24 usebundle2 = (repo.ui.configbool('experimental', 'bundle2-exp', True) and
25 repo.ui.config('experimental', 'strip-bundle2-version'))
26 if usebundle2:
27 cgversion = repo.ui.config('experimental', 'strip-bundle2-version')
28 if cgversion not in changegroup.packermap:
29 repo.ui.warn(_('unknown strip-bundle2-version value %r; '
30 'should be one of %r\n') %
31 (cgversion, sorted(changegroup.packermap.keys()),))
32 24 cgversion = '01'
33 usebundle2 = False
34 else:
35 cgversion = '01'
25 if 'generaldelta' in repo.requirements:
26 cgversion = '02'
36 27
37 28 cg = changegroup.changegroupsubset(repo, bases, heads, 'strip',
38 29 version=cgversion)
@@ -47,7 +38,7 b' def _bundle(repo, bases, heads, node, su'
47 38 totalhash = util.sha1(''.join(allhashes)).hexdigest()
48 39 name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix)
49 40
50 if usebundle2:
41 if cgversion != '01':
51 42 bundletype = "HG20"
52 43 elif compress:
53 44 bundletype = "HG10BZ"
@@ -102,4 +102,13 b' Test format.aggressivemergedeltas'
102 102 1 59 59 -1 1 315c023f341d 000000000000 000000000000
103 103 2 118 62 0 2 2ab389a983eb 315c023f341d 8dde941edb6e
104 104
105 Test that strip bundle use bundle2
106 $ hg --config extensions.strip= strip .
107 0 files updated, 0 files merged, 5 files removed, 0 files unresolved
108 saved backup bundle to $TESTTMP/aggressive/.hg/strip-backup/1c5d4dc9a8b8-6c68e60c-backup.hg (glob)
109 $ hg debugbundle .hg/strip-backup/*
110 Stream params: {}
111 changegroup -- "{'version': '02'}"
112 1c5d4dc9a8b8d6e1750966d343e94db665e7a1e9
113
105 114 $ cd ..
@@ -185,7 +185,7 b' pull --rebase works with bundle2 turned '
185 185 o 0: 'C1'
186 186
187 187 $ cd ../c
188 $ hg pull --rebase --config experimental.bundle2-exp=True --config experimental.strip-bundle2-version=02
188 $ hg pull --rebase
189 189 pulling from $TESTTMP/a (glob)
190 190 searching for changes
191 191 adding changesets
@@ -197,17 +197,8 b''
197 197 date: Thu Jan 01 00:00:00 1970 +0000
198 198 summary: c
199 199
200 $ hg --config experimental.bundle2-exp=True --config experimental.strip-bundle2-version=INVALID strip 4
201 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
202 unknown strip-bundle2-version value 'INVALID'; should be one of ['01', '02']
203 saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg (glob)
204 $ hg debugbundle .hg/strip-backup/*
205 264128213d290d868c54642d13aeaa3675551a78
206 $ restore
207 200
208 $ hg up -C 4
209 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
210 $ hg --config experimental.bundle2-exp=True --config experimental.strip-bundle2-version=02 --traceback strip 4
201 $ hg --traceback strip 4
211 202 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
212 203 saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg (glob)
213 204 $ hg parents
@@ -217,34 +208,6 b''
217 208 summary: b
218 209
219 210 $ hg debugbundle .hg/strip-backup/*
220 Stream params: {}
221 changegroup -- "{'version': '02'}"
222 264128213d290d868c54642d13aeaa3675551a78
223 $ hg incoming .hg/strip-backup/*
224 comparing with .hg/strip-backup/264128213d29-0b39d6bf-backup.hg
225 searching for changes
226 changeset: 4:264128213d29
227 tag: tip
228 parent: 1:ef3a871183d7
229 user: test
230 date: Thu Jan 01 00:00:00 1970 +0000
231 summary: c
232
233 $ restore
234 $ hg up -C 4
235 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
236 $ hg --config experimental.bundle2-exp=True --config experimental.strip-bundle2-version=02 --traceback strip 4
237 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
238 saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg (glob)
239 $ hg parents
240 changeset: 1:ef3a871183d7
241 user: test
242 date: Thu Jan 01 00:00:00 1970 +0000
243 summary: b
244
245 $ hg debugbundle .hg/strip-backup/*
246 Stream params: {}
247 changegroup -- "{'version': '02'}"
248 211 264128213d290d868c54642d13aeaa3675551a78
249 212 $ hg pull .hg/strip-backup/*
250 213 pulling from .hg/strip-backup/264128213d29-0b39d6bf-backup.hg
General Comments 0
You need to be logged in to leave comments. Login now