##// END OF EJS Templates
commands.debugbundle: bundle2 support...
Eric Sumner -
r23888:6d8bebf4 default
parent child Browse files
Show More
@@ -21,7 +21,7 b' import minirst, revset, fileset'
21 import dagparser, context, simplemerge, graphmod, copies
21 import dagparser, context, simplemerge, graphmod, copies
22 import random
22 import random
23 import setdiscovery, treediscovery, dagutil, pvec, localrepo
23 import setdiscovery, treediscovery, dagutil, pvec, localrepo
24 import phases, obsolete, exchange
24 import phases, obsolete, exchange, bundle2
25 import ui as uimod
25 import ui as uimod
26
26
27 table = {}
27 table = {}
@@ -1816,6 +1816,8 b' def debugbundle(ui, bundlepath, all=None'
1816 f = hg.openpath(ui, bundlepath)
1816 f = hg.openpath(ui, bundlepath)
1817 try:
1817 try:
1818 gen = exchange.readbundle(ui, f, bundlepath)
1818 gen = exchange.readbundle(ui, f, bundlepath)
1819 if isinstance(gen, bundle2.unbundle20):
1820 return _debugbundle2(ui, gen, all=all, **opts)
1819 if all:
1821 if all:
1820 ui.write(("format: id, p1, p2, cset, delta base, len(delta)\n"))
1822 ui.write(("format: id, p1, p2, cset, delta base, len(delta)\n"))
1821
1823
@@ -1848,6 +1850,8 b' def debugbundle(ui, bundlepath, all=None'
1848 fname = chunkdata['filename']
1850 fname = chunkdata['filename']
1849 showchunks(fname)
1851 showchunks(fname)
1850 else:
1852 else:
1853 if isinstance(gen, bundle2.unbundle20):
1854 raise util.Abort(_('use debugbundle2 for this file'))
1851 chunkdata = gen.changelogheader()
1855 chunkdata = gen.changelogheader()
1852 chain = None
1856 chain = None
1853 while True:
1857 while True:
@@ -1860,6 +1864,26 b' def debugbundle(ui, bundlepath, all=None'
1860 finally:
1864 finally:
1861 f.close()
1865 f.close()
1862
1866
1867 def _debugbundle2(ui, gen, **opts):
1868 """lists the contents of a bundle2"""
1869 if not isinstance(gen, bundle2.unbundle20):
1870 raise util.Abort(_('not a bundle2 file'))
1871 ui.write(('Stream params: %s\n' % repr(gen.params)))
1872 for part in gen.iterparts():
1873 ui.write('%s -- %r\n' % (part.type, repr(part.params)))
1874 if part.type == 'b2x:changegroup':
1875 version = part.params.get('version', '01')
1876 cg = changegroup.packermap[version][1](part, 'UN')
1877 chunkdata = cg.changelogheader()
1878 chain = None
1879 while True:
1880 chunkdata = cg.deltachunk(chain)
1881 if not chunkdata:
1882 break
1883 node = chunkdata['node']
1884 ui.write(" %s\n" % hex(node))
1885 chain = node
1886
1863 @command('debugcheckstate', [], '')
1887 @command('debugcheckstate', [], '')
1864 def debugcheckstate(ui, repo):
1888 def debugcheckstate(ui, repo):
1865 """validate the correctness of the current dirstate"""
1889 """validate the correctness of the current dirstate"""
@@ -755,6 +755,13 b' Support for changegroup'
755 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02H (esc)
755 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02H (esc)
756 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
756 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
757
757
758 $ hg debugbundle ../rev.hg2
759 Stream params: {}
760 b2x:changegroup -- '{}'
761 32af7686d403cf45b5d95f2d70cebea587ac806a
762 9520eea781bcca16c1e15acc0ba14335a0e8e5ba
763 eea13746799a9e0bfd88f29d3c2e9dc9389f524f
764 02de42196ebee42ef284b6780a87cdc96e8eaab6
758 $ hg unbundle2 < ../rev.hg2
765 $ hg unbundle2 < ../rev.hg2
759 adding changesets
766 adding changesets
760 adding manifests
767 adding manifests
General Comments 0
You need to be logged in to leave comments. Login now