##// 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 import setdiscovery, treediscovery, dagutil, pvec, localrepo, destutil
23 import setdiscovery, treediscovery, dagutil, pvec, localrepo, destutil
24 import phases, obsolete, exchange, bundle2, repair, lock as lockmod
24 import phases, obsolete, exchange, bundle2, repair, lock as lockmod
25 import ui as uimod
25 import ui as uimod
26 import streamclone
26
27
27 table = {}
28 table = {}
28
29
@@ -1250,6 +1251,11 b' def bundle(ui, repo, fname, dest=None, *'
1250 hint=_('see "hg help bundle" for supported '
1251 hint=_('see "hg help bundle" for supported '
1251 'values for --type'))
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 if opts.get('all'):
1259 if opts.get('all'):
1254 base = ['null']
1260 base = ['null']
1255 else:
1261 else:
@@ -1960,6 +1966,18 b' def _debugbundle2(ui, gen, **opts):'
1960 ui.write(" %s\n" % hex(node))
1966 ui.write(" %s\n" % hex(node))
1961 chain = node
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 @command('debugcheckstate', [], '')
1981 @command('debugcheckstate', [], '')
1964 def debugcheckstate(ui, repo):
1982 def debugcheckstate(ui, repo):
1965 """validate the correctness of the current dirstate"""
1983 """validate the correctness of the current dirstate"""
@@ -250,6 +250,44 b' Pull full.hg into empty again (using -R;'
250 changegroup hook: HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735 HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=bundle:empty+full.hg (glob)
250 changegroup hook: HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735 HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=bundle:empty+full.hg (glob)
251 (run 'hg heads' to see heads, 'hg merge' to merge)
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 Create partial clones
291 Create partial clones
254
292
255 $ rm -r empty
293 $ rm -r empty
@@ -75,6 +75,7 b' Show debug commands if there are no othe'
75 debugcommands
75 debugcommands
76 debugcomplete
76 debugcomplete
77 debugconfig
77 debugconfig
78 debugcreatestreamclonebundle
78 debugdag
79 debugdag
79 debugdata
80 debugdata
80 debugdate
81 debugdate
@@ -236,6 +237,7 b' Show all commands + options'
236 debugcheckstate:
237 debugcheckstate:
237 debugcommands:
238 debugcommands:
238 debugcomplete: options
239 debugcomplete: options
240 debugcreatestreamclonebundle:
239 debugdag: tags, branches, dots, spaces
241 debugdag: tags, branches, dots, spaces
240 debugdata: changelog, manifest, dir
242 debugdata: changelog, manifest, dir
241 debugdate: extended
243 debugdate: extended
@@ -791,6 +791,8 b' Test list of internal help commands'
791 list all available commands and options
791 list all available commands and options
792 debugcomplete
792 debugcomplete
793 returns the completion list associated with the given command
793 returns the completion list associated with the given command
794 debugcreatestreamclonebundle
795 create a stream clone bundle file
794 debugdag format the changelog or an index DAG as a concise textual
796 debugdag format the changelog or an index DAG as a concise textual
795 description
797 description
796 debugdata dump the contents of a data file revision
798 debugdata dump the contents of a data file revision
@@ -1064,10 +1066,11 b' Test keyword search help'
1064
1066
1065 Commands:
1067 Commands:
1066
1068
1067 bookmarks create a new bookmark or list existing bookmarks
1069 bookmarks create a new bookmark or list existing bookmarks
1068 clone make a copy of an existing repository
1070 clone make a copy of an existing repository
1069 paths show aliases for remote repositories
1071 debugcreatestreamclonebundle create a stream clone bundle file
1070 update update working directory (or switch revisions)
1072 paths show aliases for remote repositories
1073 update update working directory (or switch revisions)
1071
1074
1072 Extensions:
1075 Extensions:
1073
1076
General Comments 0
You need to be logged in to leave comments. Login now