changeset 13416:5431b3f3e52e

bookmarks: make track.current=True default behaviour and remove option (BC)
author David Soria Parra <dsp@php.net>
date Wed, 16 Feb 2011 01:29:26 +0100
parents 25b5694b9337
children 0748e18be470
files mercurial/bookmarks.py mercurial/commands.py tests/test-bookmarks-current.t tests/test-bookmarks-pushpull.t tests/test-bookmarks-rebase.t tests/test-bookmarks-strip.t tests/test-bookmarks.t
diffstat 7 files changed, 36 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Wed Feb 16 01:28:42 2011 +0100
+++ b/mercurial/bookmarks.py	Wed Feb 16 01:29:26 2011 +0100
@@ -109,16 +109,10 @@
 def update(repo, parents, node):
     marks = repo._bookmarks
     update = False
-    if repo.ui.configbool('bookmarks', 'track.current'):
-        mark = repo._bookmarkcurrent
-        if mark and marks[mark] in parents:
-            marks[mark] = node
-            update = True
-    else:
-        for mark, n in marks.items():
-            if n in parents:
-                marks[mark] = node
-                update = True
+    mark = repo._bookmarkcurrent
+    if mark and marks[mark] in parents:
+        marks[mark] = node
+        update = True
     if update:
         write(repo)
 
--- a/mercurial/commands.py	Wed Feb 16 01:28:42 2011 +0100
+++ b/mercurial/commands.py	Wed Feb 16 01:29:26 2011 +0100
@@ -532,17 +532,11 @@
             ui.status(_("no bookmarks set\n"))
         else:
             for bmark, n in sorted(marks.iteritems()):
-                if ui.configbool('bookmarks', 'track.current'):
-                    current = repo._bookmarkcurrent
-                    if bmark == current and n == cur:
-                        prefix, label = '*', 'bookmarks.current'
-                    else:
-                        prefix, label = ' ', ''
+                current = repo._bookmarkcurrent
+                if bmark == current and n == cur:
+                    prefix, label = '*', 'bookmarks.current'
                 else:
-                    if n == cur:
-                        prefix, label = '*', 'bookmarks.current'
-                    else:
-                        prefix, label = ' ', ''
+                    prefix, label = ' ', ''
 
                 if ui.quiet:
                     ui.write("%s\n" % bmark, label=label)
@@ -4059,7 +4053,7 @@
     else:
         ret = hg.update(repo, rev)
 
-    if repo.ui.configbool('bookmarks', 'track.current'):
+    if brev in repo._bookmarks:
         bookmarks.setcurrent(repo, brev)
 
     return ret
--- a/tests/test-bookmarks-current.t	Wed Feb 16 01:28:42 2011 +0100
+++ b/tests/test-bookmarks-current.t	Wed Feb 16 01:29:26 2011 +0100
@@ -2,7 +2,6 @@
   $ echo "bookmarks=" >> $HGRCPATH
 
   $ echo "[bookmarks]" >> $HGRCPATH
-  $ echo "track.current = True" >> $HGRCPATH
 
   $ hg init
 
--- a/tests/test-bookmarks-pushpull.t	Wed Feb 16 01:28:42 2011 +0100
+++ b/tests/test-bookmarks-pushpull.t	Wed Feb 16 01:29:26 2011 +0100
@@ -1,9 +1,6 @@
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "bookmarks=" >> $HGRCPATH
 
-  $ echo "[bookmarks]" >> $HGRCPATH
-  $ echo "track.current = True" >> $HGRCPATH
-
 initialize
 
   $ hg init a
--- a/tests/test-bookmarks-rebase.t	Wed Feb 16 01:28:42 2011 +0100
+++ b/tests/test-bookmarks-rebase.t	Wed Feb 16 01:29:26 2011 +0100
@@ -41,7 +41,6 @@
 
   $ hg log
   changeset:   3:9163974d1cb5
-  bookmark:    one
   bookmark:    two
   tag:         tip
   parent:      1:925d80f479bb
@@ -57,6 +56,7 @@
   summary:     2
   
   changeset:   1:925d80f479bb
+  bookmark:    one
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     1
--- a/tests/test-bookmarks-strip.t	Wed Feb 16 01:28:42 2011 +0100
+++ b/tests/test-bookmarks-strip.t	Wed Feb 16 01:29:26 2011 +0100
@@ -61,7 +61,7 @@
 list bookmarks
 
   $ hg book
-   * test                      1:8cf31af87a2b
+     test                      1:8cf31af87a2b
    * test2                     1:8cf31af87a2b
 
 immediate rollback and reentrancy issue
--- a/tests/test-bookmarks.t	Wed Feb 16 01:28:42 2011 +0100
+++ b/tests/test-bookmarks.t	Wed Feb 16 01:29:26 2011 +0100
@@ -54,8 +54,8 @@
 list bookmarks
 
   $ hg bookmarks
-   * X                         0:f7b1eb17ad24
-   * X2                        0:f7b1eb17ad24
+     X                         0:f7b1eb17ad24
+     X2                        0:f7b1eb17ad24
      Y                         -1:000000000000
 
   $ echo b > b
@@ -65,23 +65,21 @@
 bookmarks revset
 
   $ hg log -r 'bookmark()'
-  changeset:   1:925d80f479bb
+  changeset:   0:f7b1eb17ad24
   bookmark:    X
   bookmark:    X2
-  tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
-  summary:     1
+  summary:     0
   
   $ hg log -r 'bookmark(Y)'
   $ hg log -r 'bookmark(X2)'
-  changeset:   1:925d80f479bb
+  changeset:   0:f7b1eb17ad24
   bookmark:    X
   bookmark:    X2
-  tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
-  summary:     1
+  summary:     0
   
   $ hg help revsets | grep 'bookmark('
       "bookmark([name])"
@@ -89,23 +87,26 @@
 bookmarks X and X2 moved to rev 1, Y at rev -1
 
   $ hg bookmarks
-   * X                         1:925d80f479bb
-   * X2                        1:925d80f479bb
+     X                         0:f7b1eb17ad24
+     X2                        0:f7b1eb17ad24
      Y                         -1:000000000000
 
 bookmark rev 0 again
 
   $ hg bookmark -r 0 Z
 
+  $ hg update X
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo c > c
   $ hg add c
   $ hg commit -m 2
+  created new head
 
-bookmarks X and X2 moved to rev 2, Y at rev -1, Z at rev 0
+bookmarks X moved to rev 2, Y at rev -1, Z at rev 0
 
   $ hg bookmarks
-   * X                         2:0316ce92851d
-   * X2                        2:0316ce92851d
+   * X                         2:db815d6d32e6
+     X2                        0:f7b1eb17ad24
      Y                         -1:000000000000
      Z                         0:f7b1eb17ad24
 
@@ -128,8 +129,8 @@
 list bookmarks
 
   $ hg bookmark
-   * X2                        2:0316ce92851d
-   * Y                         2:0316ce92851d
+     X2                        0:f7b1eb17ad24
+   * Y                         2:db815d6d32e6
      Z                         0:f7b1eb17ad24
 
 rename without new name
@@ -157,19 +158,19 @@
 list bookmarks
 
   $ hg bookmarks
-   * X2                        2:0316ce92851d
-   * Y                         2:0316ce92851d
+     X2                        0:f7b1eb17ad24
+     Y                         2:db815d6d32e6
      Z                         0:f7b1eb17ad24
-   * x  y                      2:0316ce92851d
+   * x  y                      2:db815d6d32e6
 
 look up stripped bookmark name
 
   $ hg log -r '"x  y"'
-  changeset:   2:0316ce92851d
-  bookmark:    X2
+  changeset:   2:db815d6d32e6
   bookmark:    Y
   bookmark:    x  y
   tag:         tip
+  parent:      0:f7b1eb17ad24
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
@@ -195,10 +196,10 @@
 list bookmarks
 
   $ hg bookmark
-   * X2                        2:0316ce92851d
-   * Y                         2:0316ce92851d
-   * Z                         2:0316ce92851d
-   * x  y                      2:0316ce92851d
+     X2                        0:f7b1eb17ad24
+     Y                         2:db815d6d32e6
+   * Z                         2:db815d6d32e6
+     x  y                      2:db815d6d32e6
 
 revision but no bookmark name