[PATCH (BC)] bookmarks: make track.current=True default behaviour and remove option

David Soria Parra dsp at php.net
Tue Feb 15 18:31:17 CST 2011


# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1297816166 -3600
# Node ID f7400c4bd9aaa8fd313a774e268d88a594b46c64
# Parent  a2df3d9adf1cf2c453f0997eb936636ed0bba8c3
bookmarks: make track.current=True default behaviour and remove option

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -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)
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -531,17 +531,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)
@@ -4049,7 +4043,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
diff --git a/tests/test-bookmarks-current.t b/tests/test-bookmarks-current.t
--- a/tests/test-bookmarks-current.t
+++ b/tests/test-bookmarks-current.t
@@ -2,7 +2,6 @@
   $ echo "bookmarks=" >> $HGRCPATH
 
   $ echo "[bookmarks]" >> $HGRCPATH
-  $ echo "track.current = True" >> $HGRCPATH
 
   $ hg init
 
diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -1,9 +1,6 @@
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "bookmarks=" >> $HGRCPATH
 
-  $ echo "[bookmarks]" >> $HGRCPATH
-  $ echo "track.current = True" >> $HGRCPATH
-
 initialize
 
   $ hg init a
diff --git a/tests/test-bookmarks-rebase.t b/tests/test-bookmarks-rebase.t
--- a/tests/test-bookmarks-rebase.t
+++ b/tests/test-bookmarks-rebase.t
@@ -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
diff --git a/tests/test-bookmarks-strip.t b/tests/test-bookmarks-strip.t
--- a/tests/test-bookmarks-strip.t
+++ b/tests/test-bookmarks-strip.t
@@ -61,7 +61,7 @@
 list bookmarks
 
   $ hg book
-   * test                      1:8cf31af87a2b
+     test                      1:8cf31af87a2b
    * test2                     1:8cf31af87a2b
 
 immediate rollback and reentrancy issue
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -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
 


More information about the Mercurial-devel mailing list