[PATCH 3 of 4] schemas: sync schemas during clone and pull

Durham Goode durham at fb.com
Tue Aug 6 19:28:28 CDT 2013


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1375827597 25200
#      Tue Aug 06 15:19:57 2013 -0700
# Node ID 693af582853bc61a1fee181d047e944fa93da490
# Parent  ef29e2e8de0198d5041f60e9cbfc7b5a29fea93d
schemas: sync schemas during clone and pull

Makes the client update its schema list during clone and pull.
If the server has new data, the existing data is overwritten,
but if the server does not specify a value for a schema the client
already has, it is not deleted from the client.

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -405,6 +405,9 @@
 
             destrepo.ui.setconfig('paths', 'default', defaulturl)
 
+            # fetch schemas
+            destrepo.addschemas(srcpeer.schemas())
+
             if update:
                 if update is not True:
                     checkout = srcpeer.lookup(update)
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -99,6 +99,9 @@
     def known(self, nodes):
         return self._repo.known(nodes)
 
+    def schemas(self):
+        return self._repo.schemas
+
     def getbundle(self, source, heads=None, common=None, bundlecaps=None):
         return self._repo.getbundle(source, heads=heads, common=common,
                                     bundlecaps=None)
@@ -1760,6 +1763,9 @@
                 # should be seen as public
                 phases.advanceboundary(self, phases.public, subset)
 
+            # update schemas
+            self.addschemas(remote.schemas())
+
             def gettransaction():
                 if tr is None:
                     return self.transaction(trname)
diff --git a/tests/test-empty.t b/tests/test-empty.t
--- a/tests/test-empty.t
+++ b/tests/test-empty.t
@@ -46,6 +46,7 @@
   dirstate
   hgrc
   requires
+  schemas
   store
 
 Should be empty:
diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t
--- a/tests/test-hardlinks.t
+++ b/tests/test-hardlinks.t
@@ -201,6 +201,7 @@
   2 r4/.hg/hgrc
   2 r4/.hg/last-message.txt
   2 r4/.hg/requires
+  2 r4/.hg/schemas
   2 r4/.hg/store/00changelog.i
   2 r4/.hg/store/00manifest.i
   2 r4/.hg/store/data/d1/f2.d
@@ -231,6 +232,7 @@
   2 r4/.hg/hgrc
   2 r4/.hg/last-message.txt
   2 r4/.hg/requires
+  2 r4/.hg/schemas
   2 r4/.hg/store/00changelog.i
   2 r4/.hg/store/00manifest.i
   2 r4/.hg/store/data/d1/f2.d
diff --git a/tests/test-http-proxy.t b/tests/test-http-proxy.t
--- a/tests/test-http-proxy.t
+++ b/tests/test-http-proxy.t
@@ -102,24 +102,33 @@
   * - - [*] "GET http://localhost:$HGPORT/?cmd=branchmap HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
+  * - - [*] "GET http://localhost:$HGPORT/?cmd=schemas HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob)
+  * - - [*] "GET http://localhost:$HGPORT/?cmd=schemas HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
+  * - - [*] "GET http://localhost:$HGPORT/?cmd=schemas HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob)
+  * - - [*] "GET http://localhost:$HGPORT/?cmd=schemas HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
+  * - - [*] "GET http://localhost:$HGPORT/?cmd=schemas HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob)
+  * - - [*] "GET http://localhost:$HGPORT/?cmd=schemas HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
+  * - - [*] "GET http://localhost:$HGPORT/?cmd=schemas HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob)
+  * - - [*] "GET http://localhost:$HGPORT/?cmd=schemas HTTP/1.1" - - (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
+  * - - [*] "GET http://localhost:$HGPORT/?cmd=schemas HTTP/1.1" - - (glob)
 


More information about the Mercurial-devel mailing list