[PATCH 6 of 6] localrepo: sort hg bookmark output

David Soria Parra dsp at php.net
Fri Feb 11 13:37:30 CST 2011


# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1297452932 -3600
# Node ID cba930f3451c4438319211c20448bf99ed9a7857
# Parent  515f7f54cf00d97f39eda1e3161f83b50f0d58cc
localrepo: sort hg bookmark output

sort bookmarks before we write them to stdout to get a predictable output.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -530,7 +530,7 @@
         if len(marks) == 0:
             ui.status(_("no bookmarks set\n"))
         else:
-            for bmark, n in marks.iteritems():
+            for bmark, n in sorted(marks.iteritems()):
                 if ui.configbool('bookmarks', 'track.current'):
                     current = repo._bookmarkcurrent
                     if bmark == current and n == cur:
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
@@ -48,8 +48,8 @@
   no changes found
   importing bookmark X
   $ hg bookmark
+     X                         0:4e3505fd9583
      Y                         0:4e3505fd9583
-     X                         0:4e3505fd9583
 
 export bookmark by name
 
@@ -62,10 +62,10 @@
   no changes found
   exporting bookmark W
   $ hg -R ../a bookmarks
+     W                         -1:000000000000
+     X                         0:4e3505fd9583
      Y                         0:4e3505fd9583
-     X                         0:4e3505fd9583
    * Z                         0:4e3505fd9583
-     W                         -1:000000000000
 
 delete a remote bookmark
 
@@ -97,8 +97,8 @@
   adding f1
   $ hg book -f X
   $ hg book
+   * X                         1:0d2164f0ce0d
      Y                         0:4e3505fd9583
-   * X                         1:0d2164f0ce0d
      Z                         1:0d2164f0ce0d
 
   $ cd ../b
@@ -109,8 +109,8 @@
   adding f2
   $ hg book -f X
   $ hg book
+   * X                         1:9b140be10808
      Y                         0:4e3505fd9583
-   * X                         1:9b140be10808
      foo                       -1:000000000000
      foobar                    -1:000000000000
 
@@ -124,8 +124,8 @@
   not updating divergent bookmark X
   (run 'hg heads' to see heads, 'hg merge' to merge)
   $ hg book
+   * X                         1:9b140be10808
      Y                         0:4e3505fd9583
-   * X                         1:9b140be10808
      foo                       -1:000000000000
      foobar                    -1:000000000000
   $ hg push -f ../a
@@ -136,8 +136,8 @@
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
   $ hg -R ../a book
+   * X                         1:0d2164f0ce0d
      Y                         0:4e3505fd9583
-   * X                         1:0d2164f0ce0d
      Z                         1:0d2164f0ce0d
 
 hgweb
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
@@ -31,8 +31,8 @@
 bookmark list
 
   $ hg bookmark
+     one                       1:925d80f479bb
    * two                       3:2ae46b1d99a7
-     one                       1:925d80f479bb
 
 rebase
 
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
      Y                         -1:000000000000
 
   $ echo b > b
@@ -89,8 +89,8 @@
 bookmarks X and X2 moved to rev 1, Y at rev -1
 
   $ hg bookmarks
+   * X                         1:925d80f479bb
    * X2                        1:925d80f479bb
-   * X                         1:925d80f479bb
      Y                         -1:000000000000
 
 bookmark rev 0 again
@@ -104,10 +104,10 @@
 bookmarks X and X2 moved to rev 2, Y at rev -1, Z at rev 0
 
   $ hg bookmarks
+   * X                         2:0316ce92851d
    * X2                        2:0316ce92851d
-   * X                         2:0316ce92851d
+     Y                         -1:000000000000
      Z                         0:f7b1eb17ad24
-     Y                         -1:000000000000
 
 rename nonexistent bookmark
 


More information about the Mercurial-devel mailing list