# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1411769749 25200
#      Fri Sep 26 15:15:49 2014 -0700
# Node ID 5b6cd8526d56932b68479848fc749d7a11727c93
# Parent  d6ecdb8bfa16e7aed4f29b30fb094287156408ed
clone: explicitly push bookmarks when cloning from local to remote

We need to explicitly push all local bookmarks when doing the clone from a local
repo to a remote one through ssh. This will let us remove the manual export of
bookmarks in clone and rely on the official exchange in push and pull instead.

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -413,7 +413,8 @@
             if destpeer.local():
                 destpeer.local().clone(srcpeer, heads=revs, stream=stream)
             elif srcrepo:
-                exchange.push(srcrepo, destpeer, revs=revs)
+                exchange.push(srcrepo, destpeer, revs=revs,
+                              bookmarks=srcrepo._bookmarks.keys())
             else:
                 raise util.Abort(_("clone from remote to remote not supported"))
 
diff --git a/tests/test-init.t b/tests/test-init.t
--- a/tests/test-init.t
+++ b/tests/test-init.t
@@ -220,5 +220,6 @@
   remote: adding manifests
   remote: adding file changes
   remote: added 1 changesets with 1 changes to 1 files
+  exporting bookmark test
   $ hg -R remote-bookmarks bookmarks
      test                      0:08b9e9f63b32