##// END OF EJS Templates
commands: support creating stream clone bundles...
Gregory Szorc -
r26757:43708f92 default
parent child Browse files
Show More
@@ -23,6 +23,7 b' import random, operator'
23 23 import setdiscovery, treediscovery, dagutil, pvec, localrepo, destutil
24 24 import phases, obsolete, exchange, bundle2, repair, lock as lockmod
25 25 import ui as uimod
26 import streamclone
26 27
27 28 table = {}
28 29
@@ -1250,6 +1251,11 b' def bundle(ui, repo, fname, dest=None, *'
1250 1251 hint=_('see "hg help bundle" for supported '
1251 1252 'values for --type'))
1252 1253
1254 # Packed bundles are a pseudo bundle format for now.
1255 if cgversion == 's1':
1256 raise error.Abort(_('packed bundles cannot be produced by "hg bundle"'),
1257 hint=_('use "hg debugcreatestreamclonebundle"'))
1258
1253 1259 if opts.get('all'):
1254 1260 base = ['null']
1255 1261 else:
@@ -1960,6 +1966,18 b' def _debugbundle2(ui, gen, **opts):'
1960 1966 ui.write(" %s\n" % hex(node))
1961 1967 chain = node
1962 1968
1969 @command('debugcreatestreamclonebundle', [], 'FILE')
1970 def debugcreatestreamclonebundle(ui, repo, fname):
1971 """create a stream clone bundle file
1972
1973 Stream bundles are special bundles that are essentially archives of
1974 revlog files. They are commonly used for cloning very quickly.
1975 """
1976 requirements, gen = streamclone.generatebundlev1(repo)
1977 changegroup.writechunks(ui, gen, fname)
1978
1979 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
1980
1963 1981 @command('debugcheckstate', [], '')
1964 1982 def debugcheckstate(ui, repo):
1965 1983 """validate the correctness of the current dirstate"""
@@ -250,6 +250,44 b' Pull full.hg into empty again (using -R;'
250 250 changegroup hook: HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735 HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=bundle:empty+full.hg (glob)
251 251 (run 'hg heads' to see heads, 'hg merge' to merge)
252 252
253 Cannot produce streaming clone bundles with "hg bundle"
254
255 $ hg -R test bundle -t packed1 packed.hg
256 abort: packed bundles cannot be produced by "hg bundle"
257 (use "hg debugcreatestreamclonebundle")
258 [255]
259
260 packed1 is produced properly
261
262 $ hg -R test debugcreatestreamclonebundle packed.hg
263 writing 2608 bytes for 6 files
264 bundle requirements: revlogv1
265
266 $ f -B 64 --size --sha1 --hexdump packed.hg
267 packed.hg: size=2758, sha1=864c1c7b490bac9f2950ef5a660668378ac0524e
268 0000: 48 47 53 31 55 4e 00 00 00 00 00 00 00 06 00 00 |HGS1UN..........|
269 0010: 00 00 00 00 0a 30 00 09 72 65 76 6c 6f 67 76 31 |.....0..revlogv1|
270 0020: 00 64 61 74 61 2f 61 64 69 66 66 65 72 65 6e 74 |.data/adifferent|
271 0030: 66 69 6c 65 2e 69 00 31 33 39 0a 00 01 00 01 00 |file.i.139......|
272
273 generaldelta requirement is listed in stream clone bundles
274
275 $ hg --config format.generaldelta=true init testgd
276 $ cd testgd
277 $ touch foo
278 $ hg -q commit -A -m initial
279 $ cd ..
280 $ hg -R testgd debugcreatestreamclonebundle packedgd.hg
281 writing 301 bytes for 3 files
282 bundle requirements: generaldelta, revlogv1
283
284 $ f -B 64 --size --sha1 --hexdump packedgd.hg
285 packedgd.hg: size=396, sha1=981f9e589799335304a5a9a44caa3623a48d2a9f
286 0000: 48 47 53 31 55 4e 00 00 00 00 00 00 00 03 00 00 |HGS1UN..........|
287 0010: 00 00 00 00 01 2d 00 16 67 65 6e 65 72 61 6c 64 |.....-..generald|
288 0020: 65 6c 74 61 2c 72 65 76 6c 6f 67 76 31 00 64 61 |elta,revlogv1.da|
289 0030: 74 61 2f 66 6f 6f 2e 69 00 36 34 0a 00 03 00 01 |ta/foo.i.64.....|
290
253 291 Create partial clones
254 292
255 293 $ rm -r empty
@@ -75,6 +75,7 b' Show debug commands if there are no othe'
75 75 debugcommands
76 76 debugcomplete
77 77 debugconfig
78 debugcreatestreamclonebundle
78 79 debugdag
79 80 debugdata
80 81 debugdate
@@ -236,6 +237,7 b' Show all commands + options'
236 237 debugcheckstate:
237 238 debugcommands:
238 239 debugcomplete: options
240 debugcreatestreamclonebundle:
239 241 debugdag: tags, branches, dots, spaces
240 242 debugdata: changelog, manifest, dir
241 243 debugdate: extended
@@ -791,6 +791,8 b' Test list of internal help commands'
791 791 list all available commands and options
792 792 debugcomplete
793 793 returns the completion list associated with the given command
794 debugcreatestreamclonebundle
795 create a stream clone bundle file
794 796 debugdag format the changelog or an index DAG as a concise textual
795 797 description
796 798 debugdata dump the contents of a data file revision
@@ -1064,10 +1066,11 b' Test keyword search help'
1064 1066
1065 1067 Commands:
1066 1068
1067 bookmarks create a new bookmark or list existing bookmarks
1068 clone make a copy of an existing repository
1069 paths show aliases for remote repositories
1070 update update working directory (or switch revisions)
1069 bookmarks create a new bookmark or list existing bookmarks
1070 clone make a copy of an existing repository
1071 debugcreatestreamclonebundle create a stream clone bundle file
1072 paths show aliases for remote repositories
1073 update update working directory (or switch revisions)
1071 1074
1072 1075 Extensions:
1073 1076
General Comments 0
You need to be logged in to leave comments. Login now