[PATCH 2 of 4] clone to master bookmark if available

arne_bab at web.de arne_bab at web.de
Fri Nov 4 04:42:07 CDT 2011


# HG changeset patch
# User Arne Babenhauserheide <bab at draketo.de>
# Date 1320398369 -3600
# Node ID 8f614fd777b7190329b9fe705b6e1f518d9193ab
# Parent  0cc7332a0bb20c3daf003f3fe0a140f5925f0eb8
clone to master bookmark if available.

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -376,12 +376,23 @@ def clone(ui, peeropts, source, dest=Non
                     for k, n in srcrepo._bookmarks.iteritems():
                         destrepo.pushkey('bookmarks', k, '', hex(n))
 
+            # check for a master bookmark on the default branch
+            try:
+                # make sure, master is a bookmark
+                master = destrepo._bookmarks['master']
+                m = destrepo['master']
+                if not m.branch() == 'default':
+                    master = None
+                print "master:", master, m
+            except: master = None
+
             if update:
                 if update is not True:
                     checkout = update
                     if srcrepo.local():
                         checkout = srcrepo.lookup(update)
-                for test in (checkout, 'default', 'tip'):
+
+                for test in (checkout, master, 'default', 'tip'):
                     if test is None:
                         continue
                     try:


More information about the Mercurial-devel mailing list