Patchwork [2,of,3,V3] schemas: add schemas listkeys implementation

login
register
mail settings
Submitter Durham Goode
Date Aug. 14, 2013, 9:02 p.m.
Message ID <d43e79e852d560c9990a.1376514124@dev350.prn1.facebook.com>
Download mbox | patch
Permalink /patch/2177/
State Changes Requested
Headers show

Comments

Durham Goode - Aug. 14, 2013, 9:02 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1375827497 25200
#      Tue Aug 06 15:18:17 2013 -0700
# Node ID d43e79e852d560c9990aa2ac2de878c73e9b88ad
# Parent  84ac4b920802805474d203b5b5dc1cd4aa861256
schemas: add schemas listkeys implementation

This adds the wire protocol logic for requesting and transmitting
schema data. It is transmitted via the existing listkeys protocol,
but schemas cannot be pushed to the server.
Martin Geisler - Aug. 15, 2013, 8:04 a.m.
Durham Goode <durham@fb.com> writes:

> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1375827497 25200
> #      Tue Aug 06 15:18:17 2013 -0700
> # Node ID d43e79e852d560c9990aa2ac2de878c73e9b88ad
> # Parent  84ac4b920802805474d203b5b5dc1cd4aa861256
> schemas: add schemas listkeys implementation
>
> This adds the wire protocol logic for requesting and transmitting
> schema data. It is transmitted via the existing listkeys protocol,
> but schemas cannot be pushed to the server.

Oh, it seems you do use the listkey system :) Great!

What confused me was that you talk about adding logic to the wire
protocol when you're really just using the existing protocol without
extending it.

In other words: this reviewer has a very short attention span and poor
read-ahead capabilities :) So think about spelling out the obvious and
highlight when you're using existing infrastructure (that automatically
makes your patch seem more elegant).

Patch

diff --git a/mercurial/pushkey.py b/mercurial/pushkey.py
--- a/mercurial/pushkey.py
+++ b/mercurial/pushkey.py
@@ -19,6 +19,7 @@ 
                "bookmarks": (bookmarks.pushbookmark, bookmarks.listbookmarks),
                "phases": (phases.pushphase, phases.listphases),
                "obsolete": (obsolete.pushmarker, obsolete.listmarkers),
+               "schemas": (lambda *x: False, lambda repo: repo.schemas),
               }
 
 def register(namespace, pushkey, listkeys):
diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -54,6 +54,7 @@ 
   namespaces	
   obsolete	
   phases	
+  schemas	
   $ hg debugpushkey ../a bookmarks
   X	4e3505fd95835d721066b76e75dbb8cc554d7f77
   Y	4e3505fd95835d721066b76e75dbb8cc554d7f77
@@ -340,6 +341,7 @@ 
   namespaces	
   obsolete	
   phases	
+  schemas	
   $ hg debugpushkey http://localhost:$HGPORT/ bookmarks
   @	9b140be1080824d768c5a4691a564088eede71f9
   X	9b140be1080824d768c5a4691a564088eede71f9
diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -167,6 +167,7 @@ 
   bookmarks	
   namespaces	
   phases	
+  schemas	
   $ hg book foo -r 0
   $ hg out -B
   comparing with ssh://user@dummy/remote