[PATCH] test-walk: add more tests for -I/-X

Martin von Zweigbergk martinvonz at google.com
Mon May 18 23:17:00 UTC 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1415215557 28800
#      Wed Nov 05 11:25:57 2014 -0800
# Node ID 5489a9e2993d150da41da39dc34313b437e1324e
# Parent  08d1ef09ed371bfa6982ea67f6c92b495d42c520
test-walk: add more tests for -I/-X

We had very limited testing of -I and -X, especially when combined
with plain file patterns and with each other. This adds some more
protection against regressions as upcoming patches modify the matcher
code. (Originally meant for my own upcoming patches, but now I know
drgott will be sending some patches soon.)

The only noteworthy cases seems to be that both of

  hg debugwalk -Xbeans/black beans/black
  hg debugwalk -Xbeans beans/black

walk the file. I would personally have expected the -X to trump. I
don't care enough to change it, but I also think it's fair if some
future commit changes the behavior.

diff --git a/tests/test-walk.t b/tests/test-walk.t
--- a/tests/test-walk.t
+++ b/tests/test-walk.t
@@ -170,6 +170,32 @@
   f  beans/black    beans/black
   f  fenugreek      fenugreek
   f  mammals/skunk  mammals/skunk
+  $ hg debugwalk -Ibeans mammals
+  $ hg debugwalk -Inon-existent
+  $ hg debugwalk -Inon-existent -Ibeans/black
+  f  beans/black  beans/black
+  $ hg debugwalk -Ibeans beans/black
+  f  beans/black  beans/black  exact
+  $ hg debugwalk -Ibeans/black beans
+  f  beans/black  beans/black
+  $ hg debugwalk -Xbeans/black beans
+  f  beans/borlotti  beans/borlotti
+  f  beans/kidney    beans/kidney
+  f  beans/navy      beans/navy
+  f  beans/pinto     beans/pinto
+  f  beans/turtle    beans/turtle
+  $ hg debugwalk -Xbeans/black -Ibeans
+  f  beans/borlotti  beans/borlotti
+  f  beans/kidney    beans/kidney
+  f  beans/navy      beans/navy
+  f  beans/pinto     beans/pinto
+  f  beans/turtle    beans/turtle
+  $ hg debugwalk -Xbeans/black beans/black
+  f  beans/black  beans/black  exact
+  $ hg debugwalk -Xbeans/black -Ibeans/black
+  $ hg debugwalk -Xbeans beans/black
+  f  beans/black  beans/black  exact
+  $ hg debugwalk -Xbeans -Ibeans/black
   $ hg debugwalk 'glob:mammals/../beans/b*'
   f  beans/black     beans/black
   f  beans/borlotti  beans/borlotti


More information about the Mercurial-devel mailing list