[PATCH] Get Bookmarks before updating the repository files.

arne_bab at web.de arne_bab at web.de
Tue Nov 29 11:06:26 CST 2011


# HG changeset patch
# User Arne Babenhauserheide <bab at draketo.de>
# Date 1320398320 -3600
# Node ID d9e348082e48f87c4ecb05f0930b754348168c1b
# Parent  a708b65baeb92ce4971cccaee5b799b88595ddb2
clone: get all bookmarks before updating
* * *
clone: FIX: also get the bookmarks for remote target repos which support pushkey.

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -353,6 +353,21 @@ def clone(ui, peeropts, source, dest=Non
         if dircleanup:
             dircleanup.close()
 
+        # clone all bookmarks
+        if destrepo.local() and srcrepo.capable("pushkey"):
+            rb = srcrepo.listkeys('bookmarks')
+            for k, n in rb.iteritems():
+                try:
+                    m = destrepo.lookup(n)
+                    destrepo._bookmarks[k] = m
+                except error.RepoLookupError:
+                    pass
+            if rb:
+                bookmarks.write(destrepo)
+        elif srcrepo.local() and destrepo.capable("pushkey"):
+            for k, n in srcrepo._bookmarks.iteritems():
+                destrepo.pushkey('bookmarks', k, '', hex(n))
+
         if destrepo.local():
             fp = destrepo.opener("hgrc", "w", text=True)
             fp.write("[paths]\n")
@@ -378,21 +393,6 @@ def clone(ui, peeropts, source, dest=Non
                 destrepo.ui.status(_("updating to branch %s\n") % bn)
                 _update(destrepo, uprev)
 
-        # clone all bookmarks
-        if destrepo.local() and srcrepo.capable("pushkey"):
-            rb = srcrepo.listkeys('bookmarks')
-            for k, n in rb.iteritems():
-                try:
-                    m = destrepo.lookup(n)
-                    destrepo._bookmarks[k] = m
-                except error.RepoLookupError:
-                    pass
-            if rb:
-                bookmarks.write(destrepo)
-        elif srcrepo.local() and destrepo.capable("pushkey"):
-            for k, n in srcrepo._bookmarks.iteritems():
-                destrepo.pushkey('bookmarks', k, '', hex(n))
-
         return srcrepo, destrepo
     finally:
         release(srclock, destlock)


More information about the Mercurial-devel mailing list