Patchwork [03,of,24] localrepo: store branchheads sorted

login
register
mail settings
Submitter Mads Kiilerich
Date Dec. 16, 2012, 10:33 p.m.
Message ID <9e2769163db312cfdd2a.1355697238@localhost6.localdomain6>
Download mbox | patch
Permalink /patch/127/
State Accepted
Commit a4ab37ca887b5e6a090a14a2835d71c951af4288
Headers show

Comments

Mads Kiilerich - Dec. 16, 2012, 10:33 p.m.
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1355277440 -3600
# Node ID 9e2769163db312cfdd2a9d93be434d489693021c
# Parent  8b5eb2f44c24a7d940f743fa040bc77ee0b3000b
localrepo: store branchheads sorted
Bryan O'Sullivan - Dec. 17, 2012, 8:55 p.m.
On Sun, Dec 16, 2012 at 2:33 PM, Mads Kiilerich <mads at kiilerich.com> wrote:

> localrepo: store branchheads sorted
>

Same comment as before: fix the broken assumption in the tests, not the
core code that doesn't care.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20121217/379c2ea1/attachment.html>

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -733,7 +733,7 @@ 
         try:
             f = self.opener("cache/branchheads", "w", atomictemp=True)
             f.write("%s %s\n" % (hex(tip), tiprev))
-            for label, nodes in branches.iteritems():
+            for label, nodes in sorted(branches.iteritems()):
                 for node in nodes:
                     f.write("%s %s\n" % (hex(node), encoding.fromlocal(label)))
             f.close()
diff --git a/tests/test-newbranch.t b/tests/test-newbranch.t
--- a/tests/test-newbranch.t
+++ b/tests/test-newbranch.t
@@ -150,9 +150,9 @@ 
 
   $ cat $branchcache
   adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4
+  c21617b13b220988e7a2e26290fbe4325ffa7139 bar
   1c28f494dae69a2f8fc815059d257eccf3fcfe75 default
   adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 foo
-  c21617b13b220988e7a2e26290fbe4325ffa7139 bar
 
 Push should update the branch cache:
 
@@ -172,9 +172,9 @@ 
 
   $ cat ../target/$branchcache
   adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4
+  c21617b13b220988e7a2e26290fbe4325ffa7139 bar
   1c28f494dae69a2f8fc815059d257eccf3fcfe75 default
   adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 foo
-  c21617b13b220988e7a2e26290fbe4325ffa7139 bar
 
 Update with no arguments: tipmost revision of the current branch: