[PATCH 7 of 8 v2] localrepo: sort hg bookmark output

David Soria Parra dsp at php.net
Tue Feb 1 22:21:59 UTC 2011


# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1296598898 -3600
# Node ID e8802d295d69338971e15ca823eff899e4a425b0
# Parent  1a4c08114cd136381f8cf71f47365e50a11ae4db
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
@@ -534,7 +534,7 @@
         if len(repo.bookmarks) == 0:
             ui.status(_("no bookmarks set\n"))
         else:
-            for bmark, n in repo.bookmarks.iteritems():
+            for bmark, n in sorted(repo.bookmarks.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
@@ -45,8 +45,8 @@
   no changes found
   importing bookmark X
   $ hg bookmark
+     X                         0:4e3505fd9583
      Y                         0:4e3505fd9583
-     X                         0:4e3505fd9583
 
 export bookmark by name
 
@@ -59,10 +59,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
 
@@ -87,8 +87,8 @@
   adding f1
   $ hg book -f X
   $ hg book
+   * X                         1:0d2164f0ce0d
      Y                         0:4e3505fd9583
-   * X                         1:0d2164f0ce0d
      Z                         1:0d2164f0ce0d
 
   $ cd ../b
@@ -99,8 +99,8 @@
   adding f2
   $ hg book -f X
   $ hg book
+   * X                         1:9b140be10808
      Y                         0:4e3505fd9583
-   * X                         1:9b140be10808
      foo                       -1:000000000000
      foobar                    -1:000000000000
 
@@ -114,8 +114,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
@@ -126,8 +126,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
@@ -30,8 +30,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
@@ -51,8 +51,8 @@
 list bookmarks
 
   $ hg bookmarks
+   * X                         0:f7b1eb17ad24
    * X2                        0:f7b1eb17ad24
-   * X                         0:f7b1eb17ad24
      Y                         -1:000000000000
 
   $ echo b > b
@@ -86,8 +86,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
@@ -101,10 +101,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