[PATCH 5 of 8] hg: clone all bookmarks from a remote repository

dsp at php.net dsp at php.net
Sun Jan 16 16:57:41 CST 2011


# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1295218317 -3600
# Node ID 3c70953222a4a5340e4c770d11ecf622663d9e62
# Parent  f3c925a645f1d0776b5ce202bcddd072b15f67cf
hg: clone all bookmarks from a remote repository

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -366,6 +366,16 @@
                 dest_repo.ui.status(_("updating to branch %s\n") % bn)
                 _update(dest_repo, uprev)
 
+        # clone all bookmarks
+        if src_repo.capable("pushkey"):
+            rb = src_repo.listkeys('bookmarks')
+            for k, n in rb.iteritems():
+                m = dest_repo.lookup(n)
+                if m:
+                    dest_repo.bookmarks[k] = m
+            if rb:
+                dest_repo.writebookmarks()
+
         return src_repo, dest_repo
     finally:
         release(src_lock, dest_lock)


More information about the Mercurial-devel mailing list