##// 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 def _bundle(repo, bases, heads, node, suffix, compress=True):
22 def _bundle(repo, bases, heads, node, suffix, compress=True):
23 """create a bundle with the specified revisions as a backup"""
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 cgversion = '01'
24 cgversion = '01'
33 usebundle2 = False
25 if 'generaldelta' in repo.requirements:
34 else:
26 cgversion = '02'
35 cgversion = '01'
36
27
37 cg = changegroup.changegroupsubset(repo, bases, heads, 'strip',
28 cg = changegroup.changegroupsubset(repo, bases, heads, 'strip',
38 version=cgversion)
29 version=cgversion)
@@ -47,7 +38,7 b' def _bundle(repo, bases, heads, node, su'
47 totalhash = util.sha1(''.join(allhashes)).hexdigest()
38 totalhash = util.sha1(''.join(allhashes)).hexdigest()
48 name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix)
39 name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix)
49
40
50 if usebundle2:
41 if cgversion != '01':
51 bundletype = "HG20"
42 bundletype = "HG20"
52 elif compress:
43 elif compress:
53 bundletype = "HG10BZ"
44 bundletype = "HG10BZ"
@@ -102,4 +102,13 b' Test format.aggressivemergedeltas'
102 1 59 59 -1 1 315c023f341d 000000000000 000000000000
102 1 59 59 -1 1 315c023f341d 000000000000 000000000000
103 2 118 62 0 2 2ab389a983eb 315c023f341d 8dde941edb6e
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 $ cd ..
114 $ cd ..
@@ -185,7 +185,7 b' pull --rebase works with bundle2 turned '
185 o 0: 'C1'
185 o 0: 'C1'
186
186
187 $ cd ../c
187 $ cd ../c
188 $ hg pull --rebase --config experimental.bundle2-exp=True --config experimental.strip-bundle2-version=02
188 $ hg pull --rebase
189 pulling from $TESTTMP/a (glob)
189 pulling from $TESTTMP/a (glob)
190 searching for changes
190 searching for changes
191 adding changesets
191 adding changesets
@@ -197,17 +197,8 b''
197 date: Thu Jan 01 00:00:00 1970 +0000
197 date: Thu Jan 01 00:00:00 1970 +0000
198 summary: c
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
201 $ hg --traceback strip 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
211 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
202 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
212 saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg (glob)
203 saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg (glob)
213 $ hg parents
204 $ hg parents
@@ -217,34 +208,6 b''
217 summary: b
208 summary: b
218
209
219 $ hg debugbundle .hg/strip-backup/*
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 264128213d290d868c54642d13aeaa3675551a78
211 264128213d290d868c54642d13aeaa3675551a78
249 $ hg pull .hg/strip-backup/*
212 $ hg pull .hg/strip-backup/*
250 pulling from .hg/strip-backup/264128213d29-0b39d6bf-backup.hg
213 pulling from .hg/strip-backup/264128213d29-0b39d6bf-backup.hg
General Comments 0
You need to be logged in to leave comments. Login now