Patchwork [18,of,24] histedit: process bookmarks in sorted order

login
register
mail settings
Submitter Mads Kiilerich
Date Dec. 16, 2012, 10:34 p.m.
Message ID <8e79a682878e79a4119d.1355697253@localhost6.localdomain6>
Download mbox | patch
Permalink /patch/142/
State Accepted
Commit c605e12dd622d0022d72bd056530a9025c8294fd
Headers show

Comments

Mads Kiilerich - Dec. 16, 2012, 10:34 p.m.
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1355276294 -3600
# Node ID 8e79a682878e79a4119dfd3e907476204ebd0f99
# Parent  bf6de588da8525999fe4ed9d9e813eb6ce5ea9b5
histedit: process bookmarks in sorted order
Bryan O'Sullivan - Dec. 17, 2012, 9:07 p.m.
On Sun, Dec 16, 2012 at 2:34 PM, Mads Kiilerich <mads at kiilerich.com> wrote:

> histedit: process bookmarks in sorted order
>

Looks good, except for the move from iteritems to items.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20121217/3a09297c/attachment.html>

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -719,7 +719,7 @@ 
         # if nothing got rewritten there is not purpose for this function
         return
     moves = []
-    for bk, old in repo._bookmarks.iteritems():
+    for bk, old in sorted(repo._bookmarks.items()):
         if old == oldtopmost:
             # special case ensure bookmark stay on tip. 
             #
diff --git a/tests/test-histedit-bookmark-motion.t b/tests/test-histedit-bookmark-motion.t
--- a/tests/test-histedit-bookmark-motion.t
+++ b/tests/test-histedit-bookmark-motion.t
@@ -84,12 +84,12 @@ 
   > pick 652413bf663e 5 f
   > EOF
   $ hg histedit 1 --commands commands.txt --verbose | grep histedit
+  histedit: moving bookmarks also-two from 177f92b77385 to d36c0562f908
+  histedit: moving bookmarks five from 652413bf663e to 0efacef7cb48
+  histedit: moving bookmarks four from e860deea161a to ae467701c500
+  histedit: moving bookmarks three from 055a42cdd887 to ae467701c500
   histedit: moving bookmarks two from 177f92b77385 to d36c0562f908
-  histedit: moving bookmarks three from 055a42cdd887 to ae467701c500
-  histedit: moving bookmarks four from e860deea161a to ae467701c500
-  histedit: moving bookmarks also-two from 177f92b77385 to d36c0562f908
   histedit: moving bookmarks will-move-backwards from d2ae7f538514 to cb9a9f314b8b
-  histedit: moving bookmarks five from 652413bf663e to 0efacef7cb48
   saved backup bundle to $TESTTMP/r/.hg/strip-backup/d2ae7f538514-backup.hg (glob)
   saved backup bundle to $TESTTMP/r/.hg/strip-backup/34a9919932c1-backup.hg (glob)
   $ hg log --graph
@@ -141,9 +141,9 @@ 
   > pick ae467701c500 2 d
   > EOF
   $ hg histedit 1 --commands commands.txt --verbose | grep histedit
+  histedit: moving bookmarks five from 0efacef7cb48 to 1be9c35b4cb2
+  histedit: moving bookmarks four from ae467701c500 to 1be9c35b4cb2
   histedit: moving bookmarks three from ae467701c500 to 1be9c35b4cb2
-  histedit: moving bookmarks four from ae467701c500 to 1be9c35b4cb2
-  histedit: moving bookmarks five from 0efacef7cb48 to 1be9c35b4cb2
   saved backup bundle to $TESTTMP/r/.hg/strip-backup/ae467701c500-backup.hg (glob)
 
 We expect 'five' to stay at tip, since the tipmost bookmark is most