Patchwork D3480: debugbundle: also display if a part is mandatory or advisory

login
register
mail settings
Submitter phabricator
Date May 8, 2018, 10:50 a.m.
Message ID <differential-rev-PHID-DREV-byuzvngpn3ndybkuo3la-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/31333/
State Superseded
Headers show

Comments

phabricator - May 8, 2018, 10:50 a.m.
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Most parts are mandatory but when introducing new parts, they should be
  advisory if included by default or old clients won't be able to process it.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3480

AFFECTED FILES
  mercurial/debugcommands.py
  tests/test-bundle-phases.t
  tests/test-bundle-type.t
  tests/test-bundle2-format.t
  tests/test-debugbundle.t
  tests/test-generaldelta.t
  tests/test-getbundle.t
  tests/test-obsolete-changeset-exchange.t
  tests/test-obsolete.t
  tests/test-shelve.t
  tests/test-stream-bundle-v2.t
  tests/test-strip.t
  tests/test-tags.t

CHANGE DETAILS




To: lothiraldan, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-tags.t b/tests/test-tags.t
--- a/tests/test-tags.t
+++ b/tests/test-tags.t
@@ -727,13 +727,13 @@ 
   4 changesets found
   $ hg debugbundle ./test-cache-in-bundle-all-rev.hg
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 4, version: 02}
+  changegroup -- {nbchanges: 4, version: 02} (mandatory: True)
       96ee1d7354c4ad7372047672c36a1f561e3a6a4c
       c4dab0c2fd337eb9191f80c3024830a4889a8f34
       f63cc8fe54e4d326f8d692805d70e092f851ddb1
       40f0358cb314c824a5929ee527308d90e023bc10
-  hgtagsfnodes -- {}
-  cache:rev-branch-cache -- {}
+  hgtagsfnodes -- {} (mandatory: True)
+  cache:rev-branch-cache -- {} (mandatory: True)
 
 Check that local clone includes cache data
 
diff --git a/tests/test-strip.t b/tests/test-strip.t
--- a/tests/test-strip.t
+++ b/tests/test-strip.t
@@ -210,10 +210,10 @@ 
   
   $ hg debugbundle .hg/strip-backup/*
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       264128213d290d868c54642d13aeaa3675551a78
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
+  phase-heads -- {} (mandatory: True)
       264128213d290d868c54642d13aeaa3675551a78 draft
   $ hg unbundle .hg/strip-backup/*
   adding changesets
diff --git a/tests/test-stream-bundle-v2.t b/tests/test-stream-bundle-v2.t
--- a/tests/test-stream-bundle-v2.t
+++ b/tests/test-stream-bundle-v2.t
@@ -46,7 +46,7 @@ 
   $ hg bundle -a --type="none-v2;stream=v2" bundle.hg
   $ hg debugbundle bundle.hg
   Stream params: {}
-  stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Cstore}
+  stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Cstore} (mandatory: True)
   $ hg debugbundle --spec bundle.hg
   none-v2;stream=v2;requirements%3Ddotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Cstore
 
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -1122,7 +1122,7 @@ 
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg debugbundle .hg/shelved/*.hg
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       45993d65fe9dc3c6d8764b9c3b07fa831ee7d92d
   $ cd ..
 
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -1452,10 +1452,10 @@ 
   
   $ hg debugbundle .hg/strip-backup/e008cf283490-*-backup.hg
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       e008cf2834908e5d6b0f792a9d4b0e2272260fb8
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
+  phase-heads -- {} (mandatory: True)
       e008cf2834908e5d6b0f792a9d4b0e2272260fb8 draft
 
 #if repobundlerepo
@@ -1495,14 +1495,14 @@ 
   
   $ hg debugbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 2, version: 02}
+  changegroup -- {nbchanges: 2, version: 02} (mandatory: True)
       e016b03fd86fcccc54817d120b90b751aaf367d6
       b0551702f918510f01ae838ab03a463054c67b46
-  cache:rev-branch-cache -- {}
-  obsmarkers -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
+  obsmarkers -- {} (mandatory: True)
       version: 1 (92 bytes)
       e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
-  phase-heads -- {}
+  phase-heads -- {} (mandatory: True)
       b0551702f918510f01ae838ab03a463054c67b46 draft
 
   $ hg unbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
diff --git a/tests/test-obsolete-changeset-exchange.t b/tests/test-obsolete-changeset-exchange.t
--- a/tests/test-obsolete-changeset-exchange.t
+++ b/tests/test-obsolete-changeset-exchange.t
@@ -93,15 +93,15 @@ 
   1 changesets found
   $ hg debugbundle ../f89bcc95eba5.hg
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       f89bcc95eba5174b1ccc3e33a82e84c96e8338ee
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
   $ hg debugbundle ../f89bcc95eba5-obs.hg
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       f89bcc95eba5174b1ccc3e33a82e84c96e8338ee
-  cache:rev-branch-cache -- {}
-  obsmarkers -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
+  obsmarkers -- {} (mandatory: True)
       version: 1 (70 bytes)
       9d73aac1b2ed7d53835eaeec212ed41ea47da53a f89bcc95eba5174b1ccc3e33a82e84c96e8338ee 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
 
diff --git a/tests/test-getbundle.t b/tests/test-getbundle.t
--- a/tests/test-getbundle.t
+++ b/tests/test-getbundle.t
@@ -170,7 +170,7 @@ 
   $ hg debuggetbundle repo bundle -t bundle2
   $ hg debugbundle bundle
   Stream params: {}
-  changegroup -- {version: 01}
+  changegroup -- {version: 01} (mandatory: True)
       7704483d56b2a7b5db54dcee7c62378ac629b348
       29a4d1f17bd3f0779ca0525bebb1cfb51067c738
       713346a995c363120712aed1aee7e04afd867638
diff --git a/tests/test-generaldelta.t b/tests/test-generaldelta.t
--- a/tests/test-generaldelta.t
+++ b/tests/test-generaldelta.t
@@ -159,10 +159,10 @@ 
   saved backup bundle to $TESTTMP/aggressive/.hg/strip-backup/1c5d4dc9a8b8-6c68e60c-backup.hg
   $ hg debugbundle .hg/strip-backup/*
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       1c5d4dc9a8b8d6e1750966d343e94db665e7a1e9
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
+  phase-heads -- {} (mandatory: True)
       1c5d4dc9a8b8d6e1750966d343e94db665e7a1e9 draft
 
   $ cd ..
diff --git a/tests/test-debugbundle.t b/tests/test-debugbundle.t
--- a/tests/test-debugbundle.t
+++ b/tests/test-debugbundle.t
@@ -31,17 +31,17 @@ 
 
   $ hg debugbundle bundle2.hg
   Stream params: {}
-  changegroup -- {nbchanges: 2, version: 02}
+  changegroup -- {nbchanges: 2, version: 02} (mandatory: True)
       0e067c57feba1a5694ca4844f05588bb1bf82342
       991a3460af53952d10ec8a295d3d2cc2e5fa9690
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
 
 Quiet output
 
   $ hg debugbundle --quiet bundle2.hg
   Stream params: {}
-  changegroup -- {nbchanges: 2, version: 02}
-  cache:rev-branch-cache -- {}
+  changegroup -- {nbchanges: 2, version: 02} (mandatory: True)
+  cache:rev-branch-cache -- {} (mandatory: True)
 
 Verbose output:
 
@@ -64,7 +64,7 @@ 
 
   $ hg debugbundle --all bundle2.hg
   Stream params: {}
-  changegroup -- {nbchanges: 2, version: 02}
+  changegroup -- {nbchanges: 2, version: 02} (mandatory: True)
       format: id, p1, p2, cset, delta base, len(delta)
   
       changelog
@@ -80,6 +80,6 @@ 
   
       c
       b80de5d138758541c5f05265ad144ab9fa86d1db 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 991a3460af53952d10ec8a295d3d2cc2e5fa9690 0000000000000000000000000000000000000000 0
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
 
   $ cd ..
diff --git a/tests/test-bundle2-format.t b/tests/test-bundle2-format.t
--- a/tests/test-bundle2-format.t
+++ b/tests/test-bundle2-format.t
@@ -993,7 +993,7 @@ 
 
   $ hg debugbundle ../rev.hg2
   Stream params: {}
-  changegroup -- {}
+  changegroup -- {} (mandatory: False)
       32af7686d403cf45b5d95f2d70cebea587ac806a
       9520eea781bcca16c1e15acc0ba14335a0e8e5ba
       eea13746799a9e0bfd88f29d3c2e9dc9389f524f
@@ -1122,7 +1122,7 @@ 
   0370: 3b 19 fd af c5 3f f1 60 c3 17                   |;....?.`..|
   $ hg debugbundle ../rev.hg2.bz
   Stream params: {Compression: GZ}
-  changegroup -- {}
+  changegroup -- {} (mandatory: False)
       32af7686d403cf45b5d95f2d70cebea587ac806a
       9520eea781bcca16c1e15acc0ba14335a0e8e5ba
       eea13746799a9e0bfd88f29d3c2e9dc9389f524f
@@ -1209,7 +1209,7 @@ 
   0430: 2e e4 8a 70 a1 21 46 96 30 7a                   |...p.!F.0z|
   $ hg debugbundle ../rev.hg2.bz
   Stream params: {Compression: BZ}
-  changegroup -- {}
+  changegroup -- {} (mandatory: False)
       32af7686d403cf45b5d95f2d70cebea587ac806a
       9520eea781bcca16c1e15acc0ba14335a0e8e5ba
       eea13746799a9e0bfd88f29d3c2e9dc9389f524f
diff --git a/tests/test-bundle-type.t b/tests/test-bundle-type.t
--- a/tests/test-bundle-type.t
+++ b/tests/test-bundle-type.t
@@ -66,49 +66,49 @@ 
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
   none-v2
   
   % test bundle type bzip2
   searching for changes
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
   bzip2-v2
   
   % test bundle type gzip
   searching for changes
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {Compression: GZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
   gzip-v2
   
   % test bundle type none-v2
   searching for changes
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
   none-v2
   
   % test bundle type v2
   searching for changes
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
   bzip2-v2
   
   % test bundle type v1
@@ -171,19 +171,19 @@ 
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {Compression: ZS}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
   zstd-v2
   
   % test bundle type zstd-v2
   searching for changes
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {Compression: ZS}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
   zstd-v2
   
 
diff --git a/tests/test-bundle-phases.t b/tests/test-bundle-phases.t
--- a/tests/test-bundle-phases.t
+++ b/tests/test-bundle-phases.t
@@ -38,12 +38,12 @@ 
   3 changesets found
   $ hg debugbundle bundle
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 3, targetphase: 2, version: 02}
+  changegroup -- {nbchanges: 3, targetphase: 2, version: 02} (mandatory: True)
       26805aba1e600a82e93661149f2313866a221a7b
       f585351a92f85104bff7c284233c338b10eb1df7
       9bc730a19041f9ec7cb33c626e811aa233efb18c
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
+  phase-heads -- {} (mandatory: True)
       26805aba1e600a82e93661149f2313866a221a7b draft
   $ hg strip --no-backup C
   $ hg unbundle -q bundle
@@ -228,14 +228,14 @@ 
   5 changesets found
   $ hg debugbundle bundle
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 5, targetphase: 2, version: 02}
+  changegroup -- {nbchanges: 5, targetphase: 2, version: 02} (mandatory: True)
       426bada5c67598ca65036d57d9e4b64b0c1ce7a0
       112478962961147124edd43549aedd1a335e44bf
       dc0947a82db884575bb76ea10ac97b08536bfa03
       4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4
       03ca77807e919db8807c3749086dc36fb478cac0
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
+  phase-heads -- {} (mandatory: True)
       dc0947a82db884575bb76ea10ac97b08536bfa03 public
       03ca77807e919db8807c3749086dc36fb478cac0 draft
   $ hg strip --no-backup A
@@ -257,34 +257,34 @@ 
   2 changesets found
   $ hg debugbundle bundle
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 2, targetphase: 2, version: 02}
+  changegroup -- {nbchanges: 2, targetphase: 2, version: 02} (mandatory: True)
       112478962961147124edd43549aedd1a335e44bf
       4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
+  phase-heads -- {} (mandatory: True)
   $ rm bundle
 
   $ hg bundle --base A -r D bundle
   3 changesets found
   $ hg debugbundle bundle
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 3, targetphase: 2, version: 02}
+  changegroup -- {nbchanges: 3, targetphase: 2, version: 02} (mandatory: True)
       112478962961147124edd43549aedd1a335e44bf
       dc0947a82db884575bb76ea10ac97b08536bfa03
       4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
+  phase-heads -- {} (mandatory: True)
       dc0947a82db884575bb76ea10ac97b08536bfa03 public
   $ rm bundle
 
   $ hg bundle --base 'B + C' -r 'D + E' bundle
   2 changesets found
   $ hg debugbundle bundle
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 2, targetphase: 2, version: 02}
+  changegroup -- {nbchanges: 2, targetphase: 2, version: 02} (mandatory: True)
       4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4
       03ca77807e919db8807c3749086dc36fb478cac0
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: True)
+  phase-heads -- {} (mandatory: True)
       03ca77807e919db8807c3749086dc36fb478cac0 draft
   $ rm bundle
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -352,7 +352,8 @@ 
     for part in gen.iterparts():
         if parttypes and part.type not in parttypes:
             continue
-        ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
+        msg = '%s -- %s (mandatory: %r)\n'
+        ui.write((msg % (part.type, _quasirepr(part.params), part.mandatory)))
         if part.type == 'changegroup':
             version = part.params.get('version', '01')
             cg = changegroup.getunbundler(version, part, 'UN')