changeset 16276:6b16ded5c810 stable

bookmarks: clone non-divergent bookmarks with @ in them
author Kevin Bullock <kbullock@ringworld.org>
date Wed, 21 Mar 2012 16:39:38 -0500
parents 1228b5528945
children 1c2aaf05f7d7
files mercurial/bookmarks.py mercurial/hg.py tests/test-bookmarks.t
diffstat 3 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Wed Mar 21 17:24:15 2012 +0900
+++ b/mercurial/bookmarks.py	Wed Mar 21 16:39:38 2012 -0500
@@ -169,7 +169,7 @@
     d = {}
     for k, v in marks.iteritems():
         # don't expose local divergent bookmarks
-        if '@' not in k and not k.endswith('@'):
+        if '@' not in k or k.endswith('@'):
             d[k] = hex(v)
     return d
 
--- a/mercurial/hg.py	Wed Mar 21 17:24:15 2012 +0900
+++ b/mercurial/hg.py	Wed Mar 21 16:39:38 2012 -0500
@@ -356,7 +356,7 @@
         if dircleanup:
             dircleanup.close()
 
-        # clone all bookmarks
+        # clone all bookmarks except divergent ones
         if destrepo.local() and srcrepo.capable("pushkey"):
             rb = srcrepo.listkeys('bookmarks')
             for k, n in rb.iteritems():
--- a/tests/test-bookmarks.t	Wed Mar 21 17:24:15 2012 +0900
+++ b/tests/test-bookmarks.t	Wed Mar 21 16:39:38 2012 -0500
@@ -269,18 +269,24 @@
 
 test clone
 
+  $ hg bookmark -r 2 -i @
+  $ hg bookmark -r 2 -i a@
   $ hg bookmarks
+     @                         2:db815d6d32e6
      X2                        1:925d80f479bb
      Y                         2:db815d6d32e6
    * Z                         2:db815d6d32e6
+     a@                        2:db815d6d32e6
      x  y                      2:db815d6d32e6
   $ hg clone . cloned-bookmarks
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg -R cloned-bookmarks bookmarks
+     @                         2:db815d6d32e6
      X2                        1:925d80f479bb
      Y                         2:db815d6d32e6
      Z                         2:db815d6d32e6
+     a@                        2:db815d6d32e6
      x  y                      2:db815d6d32e6
 
 test clone with pull protocol
@@ -294,11 +300,16 @@
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg -R cloned-bookmarks-pull bookmarks
+     @                         2:db815d6d32e6
      X2                        1:925d80f479bb
      Y                         2:db815d6d32e6
      Z                         2:db815d6d32e6
+     a@                        2:db815d6d32e6
      x  y                      2:db815d6d32e6
 
+  $ hg bookmark -d @
+  $ hg bookmark -d a@
+
 test clone with a specific revision
 
   $ hg clone -r 925d80 . cloned-bookmarks-rev