wireprotov2: stop sending phase updates for base revisions
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 08 Oct 2018 17:54:14 -0700
changeset 40175 6c42409691ec
parent 40174 64360202d5b2
child 40176 41263df08109
wireprotov2: stop sending phase updates for base revisions This feature is broken and doesn't work properly in all scenarios. e.g. if we have the following DAGs: client server D draft C draft C draft B draft B public A public A public The current code would only send the phase data for C. The client wouldn't see that B moved from draft to public. This feature will be restored in a future commit. For now, it is making refactoring of how revisions are specified in the wire protocol a bit difficult... Differential Revision: https://phab.mercurial-scm.org/D4978
mercurial/wireprotov2server.py
tests/test-wireproto-command-changesetdata.t
tests/test-wireproto-exchangev2.t
--- a/mercurial/wireprotov2server.py	Thu Oct 11 09:47:52 2018 +0200
+++ b/mercurial/wireprotov2server.py	Mon Oct 08 17:54:14 2018 -0700
@@ -875,15 +875,11 @@
     # The phases of nodes already transferred to the client may have changed
     # since the client last requested data. We send phase-only records
     # for these revisions, if requested.
-    if b'phase' in fields and noderange is not None:
-        # TODO skip nodes whose phase will be reflected by a node in the
-        # outgoing set. This is purely an optimization to reduce data
-        # size.
-        for node in noderange[0]:
-            yield {
-                b'node': node,
-                b'phase': b'public' if publishing else repo[node].phasestr()
-            }
+    # TODO actually do this. We'll probably want to emit phase heads
+    # in the ancestry set of the outgoing revisions. This will ensure
+    # that phase updates within that set are seen.
+    if b'phase' in fields:
+        pass
 
     nodebookmarks = {}
     for mark, node in repo._bookmarks.items():
--- a/tests/test-wireproto-command-changesetdata.t	Thu Oct 11 09:47:52 2018 +0200
+++ b/tests/test-wireproto-command-changesetdata.t	Mon Oct 08 17:54:14 2018 -0700
@@ -426,6 +426,7 @@
   ]
 
 Base nodes have just their metadata (e.g. phase) transferred
+TODO this doesn't work
 
   $ sendhttpv2peer << EOF
   > command changesetdata
@@ -439,10 +440,6 @@
       b'totalitems': 3
     },
     {
-      b'node': b'3\x90\xef\x85\x00s\xfb\xc2\xf0\xdf\xff"D4,\x8e\x92)\x01:',
-      b'phase': b'public'
-    },
-    {
       b'fieldsfollowing': [
         [
           b'revision',
--- a/tests/test-wireproto-exchangev2.t	Thu Oct 11 09:47:52 2018 +0200
+++ b/tests/test-wireproto-exchangev2.t	Mon Oct 08 17:54:14 2018 -0700
@@ -324,7 +324,7 @@
   }
   received frame(size=9; request=1; stream=2; streamflags=stream-begin; type=stream-settings; flags=eos)
   received frame(size=11; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation)
-  received frame(size=613; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation)
+  received frame(size=573; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation)
   received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos)
   add changeset cd2534766bec
   add changeset e96ae20f4188
@@ -407,6 +407,7 @@
        4       4 379cb0c2e664 045c7f3927da 000000000000
 
 Phase-only update works
+TODO this doesn't work
 
   $ hg -R ../server-simple phase --public -r caa2a465451dd
   $ hg --debug pull
@@ -452,17 +453,16 @@
   }
   received frame(size=9; request=1; stream=2; streamflags=stream-begin; type=stream-settings; flags=eos)
   received frame(size=11; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation)
-  received frame(size=92; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation)
+  received frame(size=13; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation)
   received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos)
   checking for updated bookmarks
-  2 local changesets published
   (run 'hg update' to get a working copy)
   (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob)
 
   $ hg log -G -T '{rev} {node} {phase}\n'
-  o  4 caa2a465451dd1facda0f5b12312c355584188a1 public
+  o  4 caa2a465451dd1facda0f5b12312c355584188a1 draft
   |
-  o  3 e96ae20f4188487b9ae4ef3941c27c81143146e5 public
+  o  3 e96ae20f4188487b9ae4ef3941c27c81143146e5 draft
   |
   | o  2 cd2534766bece138c7c1afdc6825302f0f62d81f draft
   | |
@@ -632,7 +632,7 @@
   }
   received frame(size=9; request=1; stream=2; streamflags=stream-begin; type=stream-settings; flags=eos)
   received frame(size=11; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation)
-  received frame(size=144; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation)
+  received frame(size=65; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation)
   received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos)
   checking for updated bookmarks
   updating bookmark book-1