Patchwork [2,of,6] fileset: sort debugfileset output

login
register
mail settings
Submitter Yuya Nishihara
Date July 7, 2018, 8:38 a.m.
Message ID <8a86d134e5915eac84a1.1530952726@mimosa>
Download mbox | patch
Permalink /patch/32677/
State New
Headers show

Comments

Yuya Nishihara - July 7, 2018, 8:38 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1528536364 -32400
#      Sat Jun 09 18:26:04 2018 +0900
# Node ID 8a86d134e5915eac84a1885254463d37b6feeaeb
# Parent  45a4b2282eb3b0b57168d3949e3ab3cae1fbd989
fileset: sort debugfileset output

Unlike revset, the order of fileset result doesn't matter since it's used
as a matcher predicate. This stabilizes debugfileset output for upcoming
changes.

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -884,7 +884,7 @@  def debugfileset(ui, repo, expr, **opts)
         tree = fileset.parse(expr)
         ui.note(fileset.prettyformat(tree), "\n")
 
-    for f in ctx.getfileset(expr):
+    for f in sorted(ctx.getfileset(expr)):
         ui.write("%s\n" % f)
 
 @command('debugformat',
diff --git a/tests/test-fileset.t b/tests/test-fileset.t
--- a/tests/test-fileset.t
+++ b/tests/test-fileset.t
@@ -169,8 +169,8 @@  Test files status in different revisions
   R a2
   ? c3
   $ fileset -r0 'added() and revs("wdir()", modified() or removed() or unknown())'
+  a2
   b2
-  a2
   $ fileset -r0 'added() or revs("wdir()", added())'
   a1
   a2
@@ -192,9 +192,9 @@  Test files properties
   bin
 
   $ fileset 'grep("b{1}")'
+  b1
   b2
   c1
-  b1
   $ fileset 'grep("missingparens(")'
   hg: parse error: invalid match pattern: (unbalanced parenthesis|missing \)).* (re)
   [255]
@@ -403,21 +403,18 @@  Test with a revision
   dos
   mixed
   $ fileset 'eol(unix)'
-  mixed
   .hgsub
   .hgsubstate
   b1
   b2
   c1
+  mixed
   $ fileset 'eol(mac)'
   mac
 
 Test safety of 'encoding' on removed files
 
   $ fileset 'encoding("ascii")'
-  dos
-  mac
-  mixed
   .hgsub
   .hgsubstate
   1k
@@ -427,6 +424,9 @@  Test safety of 'encoding' on removed fil
   b2link (symlink !)
   bin
   c1
+  dos
+  mac
+  mixed
 
 Test detection of unintentional 'matchctx.existing()' invocation
 
@@ -561,12 +561,12 @@  Call with revset matching multiple revs
 ---------------------------------------
 
   $ fileset "revs('0+4', added())"
+  .hgsub
+  .hgsubstate
   a1
   a2
   b1
   b2
-  .hgsub
-  .hgsubstate
 
 overlapping set