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.
--- a/mercurial/localrepo.py Fri Oct 31 10:41:36 2014 -0700
+++ b/mercurial/localrepo.py Fri Oct 31 12:56:25 2014 -0700
@@ -1724,14 +1724,15 @@
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:
--- a/tests/test-http-proxy.t Fri Oct 31 10:41:36 2014 -0700
+++ b/tests/test-http-proxy.t Fri Oct 31 12:56:25 2014 -0700
@@ -18,6 +18,8 @@
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 @@
* - - [*] "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)
--- a/tests/test-http.t Fri Oct 31 10:41:36 2014 -0700
+++ b/tests/test-http.t Fri Oct 31 12:56:25 2014 -0700
@@ -35,6 +35,8 @@
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 @@
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 @@
"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
--- a/tests/test-ssh.t Fri Oct 31 10:41:36 2014 -0700
+++ b/tests/test-ssh.t Fri Oct 31 12:56:25 2014 -0700
@@ -38,6 +38,8 @@
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 @@
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 @@
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