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

login
register
mail settings
Submitter Durham Goode
Date Oct. 31, 2014, 8:26 p.m.
Message ID <c50354ccf4dc71077fb0.1414787174@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/6502/
State Accepted
Headers show

Comments

Durham Goode - Oct. 31, 2014, 8:26 p.m.
# HG changeset patch
# User Durham Goode <durham@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.
Matt Mackall - Oct. 31, 2014, 8:40 p.m.
On Fri, 2014-10-31 at 13:26 -0700, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@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)

Queued for stable, thanks.

Patch

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@dummy 2:hg -R nonexistent serve --stdio
   Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
   Got arguments 1:user@dummy 2:hg -R remote serve --stdio
+  Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio
   Got arguments 1:user@dummy 2:hg -R remote serve --stdio
   Got arguments 1:user@dummy 2:hg -R remote serve --stdio
   Got arguments 1:user@dummy 2:hg -R remote serve --stdio