Patchwork [STABLE] log: fix log revset instability

login
register
mail settings
Submitter Durham Goode
Date Dec. 9, 2014, 12:06 a.m.
Message ID <d5dbb3d633dd9299e434.1418083567@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/7021/
State Accepted
Commit 424d669118d323ca1aeb309f2a8a4631f69d1fe3
Headers show

Comments

Durham Goode - Dec. 9, 2014, 12:06 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1418082114 28800
#      Mon Dec 08 15:41:54 2014 -0800
# Node ID d5dbb3d633dd9299e4344e44a155e420c8b43aa7
# Parent  098a8c4c2627e08b60cc8a877d47c1507ddb6f0d
log: fix log revset instability

The log/graphlog revset was not producing stable results since it was
iterating over a dict. Now we sort before iterating to guarantee a fixed order.

This fixes some potential flakiness in the tests.
Durham Goode - Dec. 9, 2014, 12:09 a.m.
On 12/8/14 4:06 PM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1418082114 28800
> #      Mon Dec 08 15:41:54 2014 -0800
> # Node ID d5dbb3d633dd9299e4344e44a155e420c8b43aa7
> # Parent  098a8c4c2627e08b60cc8a877d47c1507ddb6f0d
> log: fix log revset instability
>
> The log/graphlog revset was not producing stable results since it was
> iterating over a dict. Now we sort before iterating to guarantee a fixed order.
>
> This fixes some potential flakiness in the tests.
>
This patch adjusts some tests added by my 'log: fix log -f slow path to 
actually follow history' patch which was queued by Matt, so it might not 
apply correctly for other people.
Matt Mackall - Dec. 9, 2014, 6:01 p.m.
On Mon, 2014-12-08 at 16:06 -0800, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1418082114 28800
> #      Mon Dec 08 15:41:54 2014 -0800
> # Node ID d5dbb3d633dd9299e4344e44a155e420c8b43aa7
> # Parent  098a8c4c2627e08b60cc8a877d47c1507ddb6f0d
> log: fix log revset instability

Queued for stable, thanks.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1795,7 +1795,7 @@  def _makelogrevset(repo, pats, opts, rev
                 filematcher = lambda rev: match
 
     expr = []
-    for op, val in opts.iteritems():
+    for op, val in sorted(opts.iteritems()):
         if not val:
             continue
         if op not in opt2revset:
diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -1660,15 +1660,15 @@  Test --follow on a directory
   (group
     (and
       (func
+        ('symbol', 'ancestors')
+        ('symbol', '.'))
+      (func
         ('symbol', '_matchfiles')
         (list
           (list
             ('string', 'r:')
             ('string', 'd:relpath'))
-          ('string', 'p:dir')))
-      (func
-        ('symbol', 'ancestors')
-        ('symbol', '.'))))
+          ('string', 'p:dir')))))
   $ hg up -q tip
 
 Test --follow on file not in parent revision
@@ -1685,15 +1685,15 @@  Test --follow and patterns
   (group
     (and
       (func
+        ('symbol', 'ancestors')
+        ('symbol', '.'))
+      (func
         ('symbol', '_matchfiles')
         (list
           (list
             ('string', 'r:')
             ('string', 'd:relpath'))
-          ('string', 'p:glob:*')))
-      (func
-        ('symbol', 'ancestors')
-        ('symbol', '.'))))
+          ('string', 'p:glob:*')))))
 
 Test --follow on a single rename
 
@@ -1862,15 +1862,15 @@  Test --removed
   (group
     (and
       (func
+        ('symbol', 'ancestors')
+        ('symbol', '.'))
+      (func
         ('symbol', '_matchfiles')
         (list
           (list
             ('string', 'r:')
             ('string', 'd:relpath'))
-          ('string', 'p:a')))
-      (func
-        ('symbol', 'ancestors')
-        ('symbol', '.'))))
+          ('string', 'p:a')))))
 
 Test --patch and --stat with --follow and --follow-first