tests: avoid unnecessarily looking inside .hg/ in test-narrow*
Many of the narrow tests were looking at .hg/narrowspec. I think most
of them were written before we added `hg tracked`, but now that we
have that command, we should fix the tests. There were also a few
instances of tests looking at .hg/dirstate. I fixed those to use `hg
files` instead.
Differential Revision: https://phab.mercurial-scm.org/D4093
--- a/tests/test-narrow-clone-no-ellipsis.t Fri Aug 03 10:56:07 2018 -0700
+++ b/tests/test-narrow-clone-no-ellipsis.t Fri Aug 03 13:00:14 2018 -0700
@@ -30,10 +30,8 @@
store
testonly-simplestore (reposimplestore !)
- $ cat .hg/narrowspec
- [includes]
- path:dir/src/f10
- [excludes]
+ $ hg tracked
+ I path:dir/src/f10
$ hg update
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ find * | sort
@@ -55,11 +53,9 @@
added 40 changesets with 19 changes to 19 files
new changesets *:* (glob)
$ cd narrowdir
- $ cat .hg/narrowspec
- [includes]
- path:dir/tests
- [excludes]
- path:dir/tests/t19
+ $ hg tracked
+ I path:dir/tests
+ X path:dir/tests/t19
$ hg update
19 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ find * | sort
@@ -97,11 +93,9 @@
added 40 changesets with 20 changes to 20 files
new changesets *:* (glob)
$ cd narrowroot
- $ cat .hg/narrowspec
- [includes]
- path:.
- [excludes]
- path:dir/tests
+ $ hg tracked
+ I path:.
+ X path:dir/tests
$ hg update
20 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ find * | sort
--- a/tests/test-narrow-clone.t Fri Aug 03 10:56:07 2018 -0700
+++ b/tests/test-narrow-clone.t Fri Aug 03 13:00:14 2018 -0700
@@ -34,10 +34,8 @@
store
testonly-simplestore (reposimplestore !)
- $ cat .hg/narrowspec
- [includes]
- path:dir/src/f10
- [excludes]
+ $ hg tracked
+ I path:dir/src/f10
$ hg tracked
I path:dir/src/f10
$ hg update
@@ -69,11 +67,9 @@
added 21 changesets with 19 changes to 19 files
new changesets *:* (glob)
$ cd narrowdir
- $ cat .hg/narrowspec
- [includes]
- path:dir/tests
- [excludes]
- path:dir/tests/t19
+ $ hg tracked
+ I path:dir/tests
+ X path:dir/tests/t19
$ hg tracked
I path:dir/tests
X path:dir/tests/t19
@@ -114,11 +110,9 @@
added 21 changesets with 20 changes to 20 files
new changesets *:* (glob)
$ cd narrowroot
- $ cat .hg/narrowspec
- [includes]
- path:.
- [excludes]
- path:dir/tests
+ $ hg tracked
+ I path:.
+ X path:dir/tests
$ hg tracked
I path:.
X path:dir/tests
--- a/tests/test-narrow-expanddirstate.t Fri Aug 03 10:56:07 2018 -0700
+++ b/tests/test-narrow-expanddirstate.t Fri Aug 03 13:00:14 2018 -0700
@@ -27,16 +27,16 @@
$ mkdir outside
$ echo other_contents > outside/f2
- $ grep outside .hg/narrowspec
+ $ hg tracked | grep outside
[1]
- $ grep outside .hg/dirstate
+ $ hg files | grep outside
[1]
$ hg status
`hg status` did not add outside.
- $ grep outside .hg/narrowspec
+ $ hg tracked | grep outside
[1]
- $ grep outside .hg/dirstate
+ $ hg files | grep outside
[1]
Unfortunately this is not really a candidate for adding to narrowhg proper,
@@ -115,12 +115,12 @@
`hg status` will now add outside, but not patchdir.
$ DIRSTATEINCLUDES=path:outside hg status
M outside/f2
- $ grep outside .hg/narrowspec
- path:outside
- $ grep outside .hg/dirstate > /dev/null
- $ grep patchdir .hg/narrowspec
+ $ hg tracked | grep outside
+ I path:outside
+ $ hg files | grep outside > /dev/null
+ $ hg tracked | grep patchdir
[1]
- $ grep patchdir .hg/dirstate
+ $ hg files | grep patchdir
[1]
Get rid of the modification to outside/f2.
@@ -142,9 +142,9 @@
1 out of 1 hunks FAILED -- saving rejects to file patchdir/f3.rej
abort: patch failed to apply
[255]
- $ grep patchdir .hg/narrowspec
+ $ hg tracked | grep patchdir
[1]
- $ grep patchdir .hg/dirstate > /dev/null
+ $ hg files | grep patchdir > /dev/null
[1]
Let's make it apply cleanly and see that it *did* expand properly
@@ -159,6 +159,6 @@
applying $TESTTMP/foo.patch
$ cat patchdir/f3
patched_this
- $ grep patchdir .hg/narrowspec
- path:patchdir
- $ grep patchdir .hg/dirstate > /dev/null
+ $ hg tracked | grep patchdir
+ I path:patchdir
+ $ hg files | grep patchdir > /dev/null
--- a/tests/test-narrow-patterns.t Fri Aug 03 10:56:07 2018 -0700
+++ b/tests/test-narrow-patterns.t Fri Aug 03 13:00:14 2018 -0700
@@ -88,15 +88,13 @@
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd narrow
- $ cat .hg/narrowspec
- [includes]
- path:dir1
- path:dir2
- [excludes]
- path:dir1/dirA
- path:dir1/dirB
- path:dir2/dirA
- path:dir2/dirB
+ $ hg tracked
+ I path:dir1
+ I path:dir2
+ X path:dir1/dirA
+ X path:dir1/dirB
+ X path:dir2/dirA
+ X path:dir2/dirB
$ hg manifest -r tip
dir1/bar
dir1/dirA/bar
@@ -144,14 +142,12 @@
adding file changes
added 9 changesets with 6 changes to 6 files
new changesets *:* (glob)
- $ cat .hg/narrowspec
- [includes]
- path:dir1
- path:dir2
- [excludes]
- path:dir1/dirB
- path:dir2/dirA
- path:dir2/dirB
+ $ hg tracked
+ I path:dir1
+ I path:dir2
+ X path:dir1/dirB
+ X path:dir2/dirA
+ X path:dir2/dirB
$ find * | sort
dir1
dir1/bar
@@ -206,14 +202,12 @@
adding file changes
added 11 changesets with 7 changes to 7 files
new changesets *:* (glob)
- $ cat .hg/narrowspec
- [includes]
- path:dir1
- path:dir2
- [excludes]
- path:dir1/dirA/bar
- path:dir1/dirB
- path:dir2/dirA
+ $ hg tracked
+ I path:dir1
+ I path:dir2
+ X path:dir1/dirA/bar
+ X path:dir1/dirB
+ X path:dir2/dirA
$ find * | sort
dir1
dir1/bar
@@ -266,14 +260,12 @@
adding file changes
added 13 changesets with 8 changes to 8 files
new changesets *:* (glob)
- $ cat .hg/narrowspec
- [includes]
- path:dir1
- path:dir2
- [excludes]
- path:dir1/dirA
- path:dir1/dirA/bar
- path:dir1/dirB
+ $ hg tracked
+ I path:dir1
+ I path:dir2
+ X path:dir1/dirA
+ X path:dir1/dirA/bar
+ X path:dir1/dirB
$ find * | sort
dir1
dir1/bar
@@ -327,13 +319,11 @@
adding file changes
added 13 changesets with 9 changes to 9 files
new changesets *:* (glob)
- $ cat .hg/narrowspec
- [includes]
- path:dir1
- path:dir2
- [excludes]
- path:dir1/dirA/bar
- path:dir1/dirB
+ $ hg tracked
+ I path:dir1
+ I path:dir2
+ X path:dir1/dirA/bar
+ X path:dir1/dirB
$ find * | sort
dir1
dir1/bar