mirror of
https://github.com/facebook/sapling.git
synced 2024-12-28 07:33:10 +03:00
debugcommands: stabilize output of debugbundle by having a custom repr
We handle all dict-like things the same, and don't worry about it actually being a repr.
This commit is contained in:
parent
e45ed2be45
commit
52fb3124b4
@ -7,6 +7,7 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import collections
|
||||
import difflib
|
||||
import errno
|
||||
import operator
|
||||
@ -323,16 +324,22 @@ def _debugphaseheads(ui, data, indent=0):
|
||||
ui.write(indent_string)
|
||||
ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
|
||||
|
||||
def _quasirepr(thing):
|
||||
if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
|
||||
return '{%s}' % (
|
||||
b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
|
||||
return pycompat.bytestr(repr(thing))
|
||||
|
||||
def _debugbundle2(ui, gen, all=None, **opts):
|
||||
"""lists the contents of a bundle2"""
|
||||
if not isinstance(gen, bundle2.unbundle20):
|
||||
raise error.Abort(_('not a bundle2 file'))
|
||||
ui.write(('Stream params: %s\n' % repr(gen.params)))
|
||||
ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
|
||||
parttypes = opts.get(r'part_type', [])
|
||||
for part in gen.iterparts():
|
||||
if parttypes and part.type not in parttypes:
|
||||
continue
|
||||
ui.write('%s -- %r\n' % (part.type, repr(part.params)))
|
||||
ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
|
||||
if part.type == 'changegroup':
|
||||
version = part.params.get('version', '01')
|
||||
cg = changegroup.getunbundler(version, part, 'UN')
|
||||
|
@ -37,12 +37,12 @@ Phases are restored when unbundling
|
||||
$ hg bundle --base B -r E bundle
|
||||
3 changesets found
|
||||
$ hg debugbundle bundle
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '3'), ('targetphase', '2')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 3, targetphase: 2, version: 02}
|
||||
26805aba1e600a82e93661149f2313866a221a7b
|
||||
f585351a92f85104bff7c284233c338b10eb1df7
|
||||
9bc730a19041f9ec7cb33c626e811aa233efb18c
|
||||
phase-heads -- 'sortdict()'
|
||||
phase-heads -- {}
|
||||
26805aba1e600a82e93661149f2313866a221a7b draft
|
||||
$ hg strip --no-backup C
|
||||
$ hg unbundle -q bundle
|
||||
@ -226,14 +226,14 @@ Restore bundle of entire repo
|
||||
$ hg bundle -a bundle
|
||||
5 changesets found
|
||||
$ hg debugbundle bundle
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '5'), ('targetphase', '2')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 5, targetphase: 2, version: 02}
|
||||
426bada5c67598ca65036d57d9e4b64b0c1ce7a0
|
||||
112478962961147124edd43549aedd1a335e44bf
|
||||
dc0947a82db884575bb76ea10ac97b08536bfa03
|
||||
4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4
|
||||
03ca77807e919db8807c3749086dc36fb478cac0
|
||||
phase-heads -- 'sortdict()'
|
||||
phase-heads -- {}
|
||||
dc0947a82db884575bb76ea10ac97b08536bfa03 public
|
||||
03ca77807e919db8807c3749086dc36fb478cac0 draft
|
||||
$ hg strip --no-backup A
|
||||
@ -254,32 +254,32 @@ Restore bundle of entire repo
|
||||
$ hg bundle --base 'A + C' -r D bundle
|
||||
2 changesets found
|
||||
$ hg debugbundle bundle
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '2'), ('targetphase', '2')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 2, targetphase: 2, version: 02}
|
||||
112478962961147124edd43549aedd1a335e44bf
|
||||
4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4
|
||||
phase-heads -- 'sortdict()'
|
||||
phase-heads -- {}
|
||||
$ rm bundle
|
||||
|
||||
$ hg bundle --base A -r D bundle
|
||||
3 changesets found
|
||||
$ hg debugbundle bundle
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '3'), ('targetphase', '2')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 3, targetphase: 2, version: 02}
|
||||
112478962961147124edd43549aedd1a335e44bf
|
||||
dc0947a82db884575bb76ea10ac97b08536bfa03
|
||||
4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4
|
||||
phase-heads -- 'sortdict()'
|
||||
phase-heads -- {}
|
||||
dc0947a82db884575bb76ea10ac97b08536bfa03 public
|
||||
$ rm bundle
|
||||
|
||||
$ hg bundle --base 'B + C' -r 'D + E' bundle
|
||||
2 changesets found
|
||||
$ hg debugbundle bundle
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '2'), ('targetphase', '2')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 2, targetphase: 2, version: 02}
|
||||
4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4
|
||||
03ca77807e919db8807c3749086dc36fb478cac0
|
||||
phase-heads -- 'sortdict()'
|
||||
phase-heads -- {}
|
||||
03ca77807e919db8807c3749086dc36fb478cac0 draft
|
||||
$ rm bundle
|
||||
|
@ -73,7 +73,7 @@ test bundle types
|
||||
1 changesets found
|
||||
HG20\x00\x00 (esc)
|
||||
Stream params: {}
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '1')])"
|
||||
changegroup -- {nbchanges: 1, version: 02}
|
||||
c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
|
||||
none-v2
|
||||
|
||||
@ -81,8 +81,8 @@ test bundle types
|
||||
searching for changes
|
||||
1 changesets found
|
||||
HG20\x00\x00 (esc)
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '1')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 1, version: 02}
|
||||
c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
|
||||
bzip2-v2
|
||||
|
||||
@ -90,8 +90,8 @@ test bundle types
|
||||
searching for changes
|
||||
1 changesets found
|
||||
HG20\x00\x00 (esc)
|
||||
Stream params: sortdict([('Compression', 'GZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '1')])"
|
||||
Stream params: {Compression: GZ}
|
||||
changegroup -- {nbchanges: 1, version: 02}
|
||||
c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
|
||||
gzip-v2
|
||||
|
||||
@ -100,7 +100,7 @@ test bundle types
|
||||
1 changesets found
|
||||
HG20\x00\x00 (esc)
|
||||
Stream params: {}
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '1')])"
|
||||
changegroup -- {nbchanges: 1, version: 02}
|
||||
c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
|
||||
none-v2
|
||||
|
||||
@ -108,8 +108,8 @@ test bundle types
|
||||
searching for changes
|
||||
1 changesets found
|
||||
HG20\x00\x00 (esc)
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '1')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 1, version: 02}
|
||||
c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
|
||||
bzip2-v2
|
||||
|
||||
@ -167,8 +167,8 @@ Compression level can be adjusted for bundle2 bundles
|
||||
searching for changes
|
||||
1 changesets found
|
||||
HG20\x00\x00 (esc)
|
||||
Stream params: sortdict([('Compression', 'ZS')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '1')])"
|
||||
Stream params: {Compression: ZS}
|
||||
changegroup -- {nbchanges: 1, version: 02}
|
||||
c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
|
||||
zstd-v2
|
||||
|
||||
@ -176,8 +176,8 @@ Compression level can be adjusted for bundle2 bundles
|
||||
searching for changes
|
||||
1 changesets found
|
||||
HG20\x00\x00 (esc)
|
||||
Stream params: sortdict([('Compression', 'ZS')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '1')])"
|
||||
Stream params: {Compression: ZS}
|
||||
changegroup -- {nbchanges: 1, version: 02}
|
||||
c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
|
||||
zstd-v2
|
||||
|
||||
|
@ -990,7 +990,7 @@ Support for changegroup
|
||||
|
||||
$ hg debugbundle ../rev.hg2
|
||||
Stream params: {}
|
||||
changegroup -- 'sortdict()'
|
||||
changegroup -- {}
|
||||
32af7686d403cf45b5d95f2d70cebea587ac806a
|
||||
9520eea781bcca16c1e15acc0ba14335a0e8e5ba
|
||||
eea13746799a9e0bfd88f29d3c2e9dc9389f524f
|
||||
@ -1118,8 +1118,8 @@ Simple case where it just work: GZ
|
||||
0360: db fb 6a 33 df c1 7d 99 cf ef d4 d5 6d da 77 7c |..j3..}.....m.w||
|
||||
0370: 3b 19 fd af c5 3f f1 60 c3 17 |;....?.`..|
|
||||
$ hg debugbundle ../rev.hg2.bz
|
||||
Stream params: sortdict([('Compression', 'GZ')])
|
||||
changegroup -- 'sortdict()'
|
||||
Stream params: {Compression: GZ}
|
||||
changegroup -- {}
|
||||
32af7686d403cf45b5d95f2d70cebea587ac806a
|
||||
9520eea781bcca16c1e15acc0ba14335a0e8e5ba
|
||||
eea13746799a9e0bfd88f29d3c2e9dc9389f524f
|
||||
@ -1205,8 +1205,8 @@ Simple case where it just work: BZ
|
||||
0420: 8b 43 88 57 9c 01 f5 61 b5 e1 27 41 7e af 83 fe |.C.W...a..'A~...|
|
||||
0430: 2e e4 8a 70 a1 21 46 96 30 7a |...p.!F.0z|
|
||||
$ hg debugbundle ../rev.hg2.bz
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- 'sortdict()'
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {}
|
||||
32af7686d403cf45b5d95f2d70cebea587ac806a
|
||||
9520eea781bcca16c1e15acc0ba14335a0e8e5ba
|
||||
eea13746799a9e0bfd88f29d3c2e9dc9389f524f
|
||||
|
@ -31,7 +31,7 @@ Terse output:
|
||||
|
||||
$ hg debugbundle bundle2.hg
|
||||
Stream params: {}
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '2')])"
|
||||
changegroup -- {nbchanges: 2, version: 02}
|
||||
0e067c57feba1a5694ca4844f05588bb1bf82342
|
||||
991a3460af53952d10ec8a295d3d2cc2e5fa9690
|
||||
|
||||
@ -56,7 +56,7 @@ Verbose output:
|
||||
|
||||
$ hg debugbundle --all bundle2.hg
|
||||
Stream params: {}
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '2')])"
|
||||
changegroup -- {nbchanges: 2, version: 02}
|
||||
format: id, p1, p2, cset, delta base, len(delta)
|
||||
|
||||
changelog
|
||||
|
@ -154,10 +154,10 @@ Test that strip bundle use bundle2
|
||||
0 files updated, 0 files merged, 5 files removed, 0 files unresolved
|
||||
saved backup bundle to $TESTTMP/aggressive/.hg/strip-backup/1c5d4dc9a8b8-6c68e60c-backup.hg (glob)
|
||||
$ hg debugbundle .hg/strip-backup/*
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '1')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 1, version: 02}
|
||||
1c5d4dc9a8b8d6e1750966d343e94db665e7a1e9
|
||||
phase-heads -- 'sortdict()'
|
||||
phase-heads -- {}
|
||||
1c5d4dc9a8b8d6e1750966d343e94db665e7a1e9 draft
|
||||
|
||||
$ cd ..
|
||||
|
@ -170,7 +170,7 @@ Get branch and merge:
|
||||
$ hg debuggetbundle repo bundle -t bundle2
|
||||
$ hg debugbundle bundle
|
||||
Stream params: {}
|
||||
changegroup -- "sortdict([('version', '01')])"
|
||||
changegroup -- {version: 01}
|
||||
7704483d56b2a7b5db54dcee7c62378ac629b348
|
||||
29a4d1f17bd3f0779ca0525bebb1cfb51067c738
|
||||
713346a995c363120712aed1aee7e04afd867638
|
||||
|
@ -90,14 +90,14 @@ check-that bundle can contain markers:
|
||||
$ hg bundle --hidden --rev f89bcc95eba5 --base "f89bcc95eba5^" ../f89bcc95eba5-obs.hg --config experimental.stabilization.bundle-obsmarker=1
|
||||
1 changesets found
|
||||
$ hg debugbundle ../f89bcc95eba5.hg
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '1')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 1, version: 02}
|
||||
f89bcc95eba5174b1ccc3e33a82e84c96e8338ee
|
||||
$ hg debugbundle ../f89bcc95eba5-obs.hg
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '1')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 1, version: 02}
|
||||
f89bcc95eba5174b1ccc3e33a82e84c96e8338ee
|
||||
obsmarkers -- 'sortdict()'
|
||||
obsmarkers -- {}
|
||||
version: 1 (70 bytes)
|
||||
9d73aac1b2ed7d53835eaeec212ed41ea47da53a f89bcc95eba5174b1ccc3e33a82e84c96e8338ee 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
|
||||
|
||||
|
@ -1344,14 +1344,14 @@ Test ability to pull changeset with locally applying obsolescence markers
|
||||
o 0:a78f55e5508c (draft) [ ] 0
|
||||
|
||||
$ hg debugbundle .hg/strip-backup/e008cf283490-*-backup.hg
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '2')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 2, version: 02}
|
||||
e008cf2834908e5d6b0f792a9d4b0e2272260fb8
|
||||
f27abbcc1f77fb409cf9160482fe619541e2d605
|
||||
obsmarkers -- 'sortdict()'
|
||||
obsmarkers -- {}
|
||||
version: 1 (70 bytes)
|
||||
f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
|
||||
phase-heads -- 'sortdict()'
|
||||
phase-heads -- {}
|
||||
f27abbcc1f77fb409cf9160482fe619541e2d605 draft
|
||||
|
||||
$ hg pull .hg/strip-backup/e008cf283490-*-backup.hg
|
||||
@ -1389,15 +1389,15 @@ Testing that strip remove markers:
|
||||
@ 0:a78f55e5508c (draft) [tip ] 0
|
||||
|
||||
$ hg debugbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '2')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 2, version: 02}
|
||||
e016b03fd86fcccc54817d120b90b751aaf367d6
|
||||
b0551702f918510f01ae838ab03a463054c67b46
|
||||
obsmarkers -- 'sortdict()'
|
||||
obsmarkers -- {}
|
||||
version: 1 (139 bytes)
|
||||
e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
|
||||
f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
|
||||
phase-heads -- 'sortdict()'
|
||||
phase-heads -- {}
|
||||
b0551702f918510f01ae838ab03a463054c67b46 draft
|
||||
|
||||
$ hg unbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
|
||||
|
@ -1117,8 +1117,8 @@ with general delta
|
||||
shelved as default
|
||||
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
||||
$ hg debugbundle .hg/shelved/*.hg
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '1')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 1, version: 02}
|
||||
45993d65fe9dc3c6d8764b9c3b07fa831ee7d92d
|
||||
$ cd ..
|
||||
|
||||
|
@ -211,10 +211,10 @@
|
||||
summary: b
|
||||
|
||||
$ hg debugbundle .hg/strip-backup/*
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '1')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 1, version: 02}
|
||||
264128213d290d868c54642d13aeaa3675551a78
|
||||
phase-heads -- 'sortdict()'
|
||||
phase-heads -- {}
|
||||
264128213d290d868c54642d13aeaa3675551a78 draft
|
||||
$ hg pull .hg/strip-backup/*
|
||||
pulling from .hg/strip-backup/264128213d29-0b39d6bf-backup.hg
|
||||
|
@ -721,13 +721,13 @@ Check that the bundle includes cache data
|
||||
$ hg -R tagsclient bundle --all ./test-cache-in-bundle-all-rev.hg
|
||||
4 changesets found
|
||||
$ hg debugbundle ./test-cache-in-bundle-all-rev.hg
|
||||
Stream params: sortdict([('Compression', 'BZ')])
|
||||
changegroup -- "sortdict([('version', '02'), ('nbchanges', '4')])"
|
||||
Stream params: {Compression: BZ}
|
||||
changegroup -- {nbchanges: 4, version: 02}
|
||||
96ee1d7354c4ad7372047672c36a1f561e3a6a4c
|
||||
c4dab0c2fd337eb9191f80c3024830a4889a8f34
|
||||
f63cc8fe54e4d326f8d692805d70e092f851ddb1
|
||||
40f0358cb314c824a5929ee527308d90e023bc10
|
||||
hgtagsfnodes -- 'sortdict()'
|
||||
hgtagsfnodes -- {}
|
||||
|
||||
Check that local clone includes cache data
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user