Patchwork [02,of,24] localrepo: store requirements sorted

login
register
mail settings
Submitter Mads Kiilerich
Date Dec. 16, 2012, 10:33 p.m.
Message ID <8b5eb2f44c24a7d940f7.1355697237@localhost6.localdomain6>
Download mbox | patch
Permalink /patch/126/
State Accepted
Commit 752f77ef7202d2ccc69fde0362197a94fb467537
Headers show

Comments

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

> localrepo: store requirements sorted
>

When I've run into this, I've used "sort .hg/store/requires" instead of
"cat .hg/store/requires" in tests. That seems to more clearly tie together
the problem and the fix.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20121217/26308198/attachment.html>

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -252,7 +252,7 @@ 
 
     def _writerequirements(self):
         reqfile = self.opener("requires", "w")
-        for r in self.requirements:
+        for r in sorted(self.requirements):
             reqfile.write("%s\n" % r)
         reqfile.close()
 
diff --git a/tests/test-init.t b/tests/test-init.t
--- a/tests/test-init.t
+++ b/tests/test-init.t
@@ -18,10 +18,10 @@ 
   $ checknewrepo local
   store created
   00changelog.i created
+  dotencode
+  fncache
   revlogv1
-  fncache
   store
-  dotencode
   $ echo this > local/foo
   $ hg ci --cwd local -A -m "init"
   adding foo
@@ -47,8 +47,8 @@ 
   $ checknewrepo old3
   store created
   00changelog.i created
+  fncache
   revlogv1
-  fncache
   store
 
 test failure
@@ -149,10 +149,10 @@ 
   $ checknewrepo local/sub/repo
   store created
   00changelog.i created
+  dotencode
+  fncache
   revlogv1
-  fncache
   store
-  dotencode
 
 prepare test of init of url configured from paths
 
@@ -166,10 +166,10 @@ 
   $ checknewrepo "url from paths"
   store created
   00changelog.i created
+  dotencode
+  fncache
   revlogv1
-  fncache
   store
-  dotencode
 
 verify that clone also expand urls
 
@@ -179,10 +179,10 @@ 
   $ checknewrepo "another paths url"
   store created
   00changelog.i created
+  dotencode
+  fncache
   revlogv1
-  fncache
   store
-  dotencode
 
 clone bookmarks
 
diff --git a/tests/test-lfconvert.t b/tests/test-lfconvert.t
--- a/tests/test-lfconvert.t
+++ b/tests/test-lfconvert.t
@@ -96,11 +96,11 @@ 
 
 "lfconvert" adds 'largefiles' to .hg/requires.
   $ cat .hg/requires
+  dotencode
+  fncache
   largefiles
   revlogv1
-  fncache
   store
-  dotencode
 
 "lfconvert" includes a newline at the end of the standin files.
   $ cat .hglf/large .hglf/sub/maybelarge.dat