[PATCH STABLE] clone: fix copying bookmarks in uncompressed clones (issue4430)

Durham Goode durham at fb.com
Fri Oct 31 15:26:14 CDT 2014


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1414785385 25200
#      Fri Oct 31 12:56:25 2014 -0700
# Branch stable
# Node ID c50354ccf4dc71077fb03e9f9fceb7599b729643
# Parent  ac494b087febf0e00a84ff2a699c0690be2c453c
clone: fix copying bookmarks in uncompressed clones (issue4430)

ef62c66bee1b broke bookmarks getting copied during uncompressed clones. Since
most of the pull logic has been moved into exchange.py, lets just call
exchange.pull to fix up the repo with the latest bits after the streaming clone
has bootstrapped the repo. This keeps us from having to duplicate the bookmark
logic.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1724,14 +1724,15 @@ class localrepository(object):
         if stream and not heads:
             # 'stream' means remote revlog format is revlogv1 only
             if remote.capable('stream'):
-                return self.stream_in(remote, set(('revlogv1',)))
-            # otherwise, 'streamreqs' contains the remote revlog format
-            streamreqs = remote.capable('streamreqs')
-            if streamreqs:
-                streamreqs = set(streamreqs.split(','))
-                # if we support it, stream in and adjust our requirements
-                if not streamreqs - self.supportedformats:
-                    return self.stream_in(remote, streamreqs)
+                self.stream_in(remote, set(('revlogv1',)))
+            else:
+                # otherwise, 'streamreqs' contains the remote revlog format
+                streamreqs = remote.capable('streamreqs')
+                if streamreqs:
+                    streamreqs = set(streamreqs.split(','))
+                    # if we support it, stream in and adjust our requirements
+                    if not streamreqs - self.supportedformats:
+                        self.stream_in(remote, streamreqs)
 
         quiet = self.ui.backupconfig('ui', 'quietbookmarkmove')
         try:
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
@@ -18,6 +18,8 @@ url for proxy, stream
   streaming all changes
   3 files to transfer, 303 bytes of data
   transferred * bytes in * seconds (*/sec) (glob)
+  searching for changes
+  no changes found
   updating to branch default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd b
@@ -101,6 +103,9 @@ do not use the proxy if it is in the no 
   * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
   * - - [*] "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=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
+  * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
   *- - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
   *- - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
diff --git a/tests/test-http.t b/tests/test-http.t
--- a/tests/test-http.t
+++ b/tests/test-http.t
@@ -35,6 +35,8 @@ clone via stream
   streaming all changes
   6 files to transfer, 606 bytes of data
   transferred * bytes in * seconds (*/sec) (glob)
+  searching for changes
+  no changes found
   updating to branch default
   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg verify -R copy
@@ -195,6 +197,8 @@ test http authentication
   streaming all changes
   7 files to transfer, 916 bytes of data
   transferred * bytes in * seconds (*/sec) (glob)
+  searching for changes
+  no changes found
   updating to branch default
   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
@@ -251,6 +255,9 @@ test http authentication
   "GET /?cmd=branchmap HTTP/1.1" 200 -
   "GET /?cmd=stream_out HTTP/1.1" 401 -
   "GET /?cmd=stream_out HTTP/1.1" 200 -
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
+  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
   "GET /?cmd=capabilities HTTP/1.1" 200 -
   "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip
   "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces
diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -38,6 +38,8 @@ clone remote via stream
   streaming all changes
   4 files to transfer, 392 bytes of data
   transferred 392 bytes in * seconds (*/sec) (glob)
+  searching for changes
+  no changes found
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd local-stream
@@ -49,6 +51,23 @@ clone remote via stream
   2 files, 1 changesets, 2 total revisions
   $ cd ..
 
+clone bookmarks via stream
+
+  $ hg -R local-stream book mybook
+  $ hg clone -e "python \"$TESTDIR/dummyssh\"" --uncompressed ssh://user@dummy/local-stream stream2
+  streaming all changes
+  4 files to transfer, 392 bytes of data
+  transferred 392 bytes in * seconds (* KB/sec) (glob)
+  searching for changes
+  no changes found
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd stream2
+  $ hg book
+     mybook                    0:1160648e36ce
+  $ cd ..
+  $ rm -rf local-stream stream2
+
 clone remote via pull
 
   $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
@@ -404,6 +423,7 @@ stderr from remote commands should be pr
   Got arguments 1:user at dummy 2:hg -R nonexistent serve --stdio
   Got arguments 1:user at dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
   Got arguments 1:user at dummy 2:hg -R remote serve --stdio
+  Got arguments 1:user at dummy 2:hg -R local-stream serve --stdio
   Got arguments 1:user at dummy 2:hg -R remote serve --stdio
   Got arguments 1:user at dummy 2:hg -R remote serve --stdio
   Got arguments 1:user at dummy 2:hg -R remote serve --stdio


More information about the Mercurial-devel mailing list