tests: show phases aren't preserved part of streaming clone (issue5648) draft
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 24 Dec 2017 10:09:41 -0700
changeset 41194 13292620537280e768f6221fc1394c744526e31c
parent 41175 7906354cbc68429109304a96d30c933fb4d87d20
child 41195 1562a410bb7c135d3ff93cc862a84ff1af9d524b
push id628
push usergszorc@mozilla.com
push dateSun, 24 Dec 2017 18:07:24 +0000
tests: show phases aren't preserved part of streaming clone (issue5648) draft and secret changesets are promoted to public changesets when transferred via a stream clone. That's not desirable behavior. Add tests demonstrating it. As far as I can tell, this buggy behavior has been present since phases were introduced. Stream clone predated phases (1.7 versus 1.9) and stream clone was never taught to be phase aware. Differential Revision: https://phab.mercurial-scm.org/D1752
tests/test-clone-uncompressed.t
--- a/tests/test-clone-uncompressed.t
+++ b/tests/test-clone-uncompressed.t
@@ -53,16 +53,74 @@ Clone with background file closing enabl
   sending getbundle command
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "listkeys" (params: 1 mandatory) supported
   bundle2-input-part: "phase-heads" supported
   bundle2-input-part: total payload size 24
   bundle2-input-bundle: 1 parts total
   checking for updated bookmarks
 
+Phases on publishing server are promoted to public
+
+  $ hg -R server log -T '{rev} {phase}\n'
+  1 draft
+  0 draft
+
+  $ hg clone --stream -U http://localhost:$HGPORT publishing-server
+  streaming all changes
+  1027 files to transfer, 96.3 KB of data
+  transferred 96.3 KB in * seconds (*/sec) (glob)
+  searching for changes
+  no changes found
+
+  $ hg -R publishing-server log -T '{rev} {phase}\n'
+  1 public
+  0 public
+
+Phases on non-publishing server are preserved as draft
+
+  $ killdaemons.py
+  $ cd server
+  $ cat >> .hg/hgrc << EOF
+  > [phases]
+  > publish = false
+  > EOF
+  $ hg serve -p $HGPORT -d --pid-file=hg.pid
+  $ cat hg.pid > $DAEMON_PIDS
+  $ cd ..
+
+  $ hg clone --stream -U http://localhost:$HGPORT all-draft
+  streaming all changes
+  1027 files to transfer, 96.3 KB of data
+  transferred 96.3 KB in * seconds (*/sec) (glob)
+  searching for changes
+  no changes found
+
+TODO this is buggy
+
+  $ hg -R all-draft log -T '{rev} {phase}\n'
+  1 public
+  0 public
+
+Mixed phase is preserved
+
+  $ hg -R server phase --public -r 0
+  $ hg clone --stream -U http://localhost:$HGPORT mixed-draft
+  streaming all changes
+  1027 files to transfer, 96.3 KB of data
+  transferred 96.3 KB in * seconds (*/sec) (glob)
+  searching for changes
+  no changes found
+
+TODO this is buggy
+
+  $ hg -R mixed-draft log -T '{rev} {phase}\n'
+  1 public
+  0 public
+
 Cannot stream clone when there are secret changesets
 
   $ hg -R server phase --force --secret -r tip
   $ hg clone --stream -U http://localhost:$HGPORT secret-denied
   warning: stream clone requested but server has them disabled
   requesting all changes
   adding changesets
   adding manifests
@@ -81,16 +139,23 @@ Streaming of secrets can be overridden b
 
   $ hg clone --stream -U http://localhost:$HGPORT secret-allowed
   streaming all changes
   1027 files to transfer, 96.3 KB of data
   transferred 96.3 KB in * seconds (*/sec) (glob)
   searching for changes
   no changes found
 
+TODO this is buggy
+(likely requires bundle2 stream clone support to fix)
+
+  $ hg -R secret-allowed log -T '{rev} {phase}\n'
+  1 public
+  0 public
+
   $ killdaemons.py
 
 Verify interaction between preferuncompressed and secret presence
 
   $ cd server
   $ hg serve --config server.preferuncompressed=true -p $HGPORT -d --pid-file=hg.pid
   $ cat hg.pid > $DAEMON_PIDS
   $ cd ..