##// END OF EJS Templates
bundlerepo: basic bundle2 support...
Eric Sumner -
r24073:ff5caa8d default
parent child Browse files
Show More
@@ -15,7 +15,7 b' from node import nullid'
15 from i18n import _
15 from i18n import _
16 import os, tempfile, shutil
16 import os, tempfile, shutil
17 import changegroup, util, mdiff, discovery, cmdutil, scmutil, exchange
17 import changegroup, util, mdiff, discovery, cmdutil, scmutil, exchange
18 import localrepo, changelog, manifest, filelog, revlog, error, phases
18 import localrepo, changelog, manifest, filelog, revlog, error, phases, bundle2
19
19
20 class bundlerevlog(revlog.revlog):
20 class bundlerevlog(revlog.revlog):
21 def __init__(self, opener, indexfile, bundle, linkmapper):
21 def __init__(self, opener, indexfile, bundle, linkmapper):
@@ -238,6 +238,24 b' class bundlerepository(localrepo.localre'
238 bundlename,
238 bundlename,
239 self.vfs)
239 self.vfs)
240
240
241 if isinstance(self.bundle, bundle2.unbundle20):
242 cgparts = [part for part in self.bundle.iterparts()
243 if (part.type == 'b2x:changegroup')
244 and (part.params.get('version', '01')
245 in changegroup.packermap)]
246
247 if not cgparts:
248 raise util.Abort('No changegroups found')
249 version = cgparts[0].params.get('version', '01')
250 cgparts = [p for p in cgparts
251 if p.params.get('version', '01') == version]
252 if len(cgparts) > 1:
253 raise NotImplementedError("Can't process multiple changegroups")
254 part = cgparts[0]
255
256 part.seek(0)
257 self.bundle = changegroup.packermap[version][1](part, 'UN')
258
241 # dict with the mapping 'filename' -> position in the bundle
259 # dict with the mapping 'filename' -> position in the bundle
242 self.bundlefilespos = {}
260 self.bundlefilespos = {}
243
261
@@ -220,8 +220,69 b''
220 Stream params: {}
220 Stream params: {}
221 b2x:changegroup -- "{'version': '02'}"
221 b2x:changegroup -- "{'version': '02'}"
222 264128213d290d868c54642d13aeaa3675551a78
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
223 $ restore
233 $ restore
224
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 b2x:changegroup -- "{'version': '02'}"
248 264128213d290d868c54642d13aeaa3675551a78
249 $ hg pull .hg/strip-backup/*
250 pulling from .hg/strip-backup/264128213d29-0b39d6bf-backup.hg
251 searching for changes
252 adding changesets
253 adding manifests
254 adding file changes
255 added 1 changesets with 0 changes to 0 files (+1 heads)
256 (run 'hg heads' to see heads, 'hg merge' to merge)
257 $ rm .hg/strip-backup/*
258 $ hg log --graph
259 o changeset: 4:264128213d29
260 | tag: tip
261 | parent: 1:ef3a871183d7
262 | user: test
263 | date: Thu Jan 01 00:00:00 1970 +0000
264 | summary: c
265 |
266 | o changeset: 3:443431ffac4f
267 | | user: test
268 | | date: Thu Jan 01 00:00:00 1970 +0000
269 | | summary: e
270 | |
271 | o changeset: 2:65bd5f99a4a3
272 |/ user: test
273 | date: Thu Jan 01 00:00:00 1970 +0000
274 | summary: d
275 |
276 @ changeset: 1:ef3a871183d7
277 | user: test
278 | date: Thu Jan 01 00:00:00 1970 +0000
279 | summary: b
280 |
281 o changeset: 0:9ab35a2d17cb
282 user: test
283 date: Thu Jan 01 00:00:00 1970 +0000
284 summary: a
285
225 $ hg up -C 2
286 $ hg up -C 2
226 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
287 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
227 $ hg merge 4
288 $ hg merge 4
General Comments 0
You need to be logged in to leave comments. Login now