bundle2: automatically add 'targetphase' parameter in writenewbundle
If we are bundling secret changeset and the bundle will contain phase, we
request the changegroup to be applied as secret.
It will be useful for next patch as we are now sure that secrets changesets
are applied as secret and not applied as draft then forced to secret.
--- a/mercurial/bundle2.py Tue Jul 11 05:11:52 2017 +0200
+++ b/mercurial/bundle2.py Tue Jul 11 05:12:03 2017 +0200
@@ -1401,6 +1401,9 @@
if 'clcount' in cg.extras:
part.addparam('nbchanges', str(cg.extras['clcount']),
mandatory=False)
+ if opts.get('phases') and repo.revs('%ln and secret()',
+ outgoing.missingheads):
+ part.addparam('targetphase', '%d' % phases.secret, mandatory=False)
addparttagsfnodescache(repo, bundler, outgoing)
--- a/tests/test-bundle-phases.t Tue Jul 11 05:11:52 2017 +0200
+++ b/tests/test-bundle-phases.t Tue Jul 11 05:12:03 2017 +0200
@@ -38,7 +38,7 @@
3 changesets found
$ hg debugbundle bundle
Stream params: sortdict([('Compression', 'BZ')])
- changegroup -- "sortdict([('version', '02'), ('nbchanges', '3')])"
+ changegroup -- "sortdict([('version', '02'), ('nbchanges', '3'), ('targetphase', '2')])"
26805aba1e600a82e93661149f2313866a221a7b
f585351a92f85104bff7c284233c338b10eb1df7
9bc730a19041f9ec7cb33c626e811aa233efb18c
@@ -227,7 +227,7 @@
5 changesets found
$ hg debugbundle bundle
Stream params: sortdict([('Compression', 'BZ')])
- changegroup -- "sortdict([('version', '02'), ('nbchanges', '5')])"
+ changegroup -- "sortdict([('version', '02'), ('nbchanges', '5'), ('targetphase', '2')])"
426bada5c67598ca65036d57d9e4b64b0c1ce7a0
112478962961147124edd43549aedd1a335e44bf
dc0947a82db884575bb76ea10ac97b08536bfa03
@@ -255,7 +255,7 @@
2 changesets found
$ hg debugbundle bundle
Stream params: sortdict([('Compression', 'BZ')])
- changegroup -- "sortdict([('version', '02'), ('nbchanges', '2')])"
+ changegroup -- "sortdict([('version', '02'), ('nbchanges', '2'), ('targetphase', '2')])"
112478962961147124edd43549aedd1a335e44bf
215e7b0814e1cac8e2614e7284f2a5dc266b4323
phase-heads -- 'sortdict()'
@@ -265,7 +265,7 @@
3 changesets found
$ hg debugbundle bundle
Stream params: sortdict([('Compression', 'BZ')])
- changegroup -- "sortdict([('version', '02'), ('nbchanges', '3')])"
+ changegroup -- "sortdict([('version', '02'), ('nbchanges', '3'), ('targetphase', '2')])"
112478962961147124edd43549aedd1a335e44bf
dc0947a82db884575bb76ea10ac97b08536bfa03
215e7b0814e1cac8e2614e7284f2a5dc266b4323
@@ -277,7 +277,7 @@
2 changesets found
$ hg debugbundle bundle
Stream params: sortdict([('Compression', 'BZ')])
- changegroup -- "sortdict([('version', '02'), ('nbchanges', '2')])"
+ changegroup -- "sortdict([('version', '02'), ('nbchanges', '2'), ('targetphase', '2')])"
215e7b0814e1cac8e2614e7284f2a5dc266b4323
03ca77807e919db8807c3749086dc36fb478cac0
phase-heads -- 'sortdict()'