D4057: narrowspec: use sparse.parseconfig() to parse narrowspec file (BC)
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Thu Aug 2 19:52:57 UTC 2018
pulkit created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This also make narrow files use 'include' and 'exclude' instead of plural forms
which are 'includes' and 'excludes'.
This is BC because now includes and excludes in all the existing narrow files
should be changed to include and exclude otherwise there will be error.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D4057
AFFECTED FILES
mercurial/narrowspec.py
tests/test-narrow-clone-no-ellipsis.t
tests/test-narrow-clone.t
tests/test-narrow-debugcommands.t
tests/test-narrow-patterns.t
CHANGE DETAILS
diff --git a/tests/test-narrow-patterns.t b/tests/test-narrow-patterns.t
--- a/tests/test-narrow-patterns.t
+++ b/tests/test-narrow-patterns.t
@@ -89,10 +89,10 @@
$ cd narrow
$ cat .hg/narrowspec
- [includes]
+ [include]
path:dir1
path:dir2
- [excludes]
+ [exclude]
path:dir1/dirA
path:dir1/dirB
path:dir2/dirA
@@ -145,10 +145,10 @@
added 9 changesets with 6 changes to 6 files
new changesets *:* (glob)
$ cat .hg/narrowspec
- [includes]
+ [include]
path:dir1
path:dir2
- [excludes]
+ [exclude]
path:dir1/dirB
path:dir2/dirA
path:dir2/dirB
@@ -207,10 +207,10 @@
added 11 changesets with 7 changes to 7 files
new changesets *:* (glob)
$ cat .hg/narrowspec
- [includes]
+ [include]
path:dir1
path:dir2
- [excludes]
+ [exclude]
path:dir1/dirA/bar
path:dir1/dirB
path:dir2/dirA
@@ -267,10 +267,10 @@
added 13 changesets with 8 changes to 8 files
new changesets *:* (glob)
$ cat .hg/narrowspec
- [includes]
+ [include]
path:dir1
path:dir2
- [excludes]
+ [exclude]
path:dir1/dirA
path:dir1/dirA/bar
path:dir1/dirB
@@ -328,10 +328,10 @@
added 13 changesets with 9 changes to 9 files
new changesets *:* (glob)
$ cat .hg/narrowspec
- [includes]
+ [include]
path:dir1
path:dir2
- [excludes]
+ [exclude]
path:dir1/dirA/bar
path:dir1/dirB
$ find * | sort
diff --git a/tests/test-narrow-debugcommands.t b/tests/test-narrow-debugcommands.t
--- a/tests/test-narrow-debugcommands.t
+++ b/tests/test-narrow-debugcommands.t
@@ -2,9 +2,9 @@
$ hg init repo
$ cd repo
$ cat << EOF > .hg/narrowspec
- > [includes]
+ > [include]
> path:foo
- > [excludes]
+ > [exclude]
> EOF
$ echo treemanifest >> .hg/requires
$ echo narrowhg-experimental >> .hg/requires
diff --git a/tests/test-narrow-clone.t b/tests/test-narrow-clone.t
--- a/tests/test-narrow-clone.t
+++ b/tests/test-narrow-clone.t
@@ -35,9 +35,9 @@
testonly-simplestore (reposimplestore !)
$ cat .hg/narrowspec
- [includes]
+ [include]
path:dir/src/f10
- [excludes]
+ [exclude]
$ hg tracked
I path:dir/src/f10
$ hg update
@@ -70,9 +70,9 @@
new changesets *:* (glob)
$ cd narrowdir
$ cat .hg/narrowspec
- [includes]
+ [include]
path:dir/tests
- [excludes]
+ [exclude]
path:dir/tests/t19
$ hg tracked
I path:dir/tests
@@ -115,9 +115,9 @@
new changesets *:* (glob)
$ cd narrowroot
$ cat .hg/narrowspec
- [includes]
+ [include]
path:.
- [excludes]
+ [exclude]
path:dir/tests
$ hg tracked
I path:.
diff --git a/tests/test-narrow-clone-no-ellipsis.t b/tests/test-narrow-clone-no-ellipsis.t
--- a/tests/test-narrow-clone-no-ellipsis.t
+++ b/tests/test-narrow-clone-no-ellipsis.t
@@ -31,9 +31,9 @@
testonly-simplestore (reposimplestore !)
$ cat .hg/narrowspec
- [includes]
+ [include]
path:dir/src/f10
- [excludes]
+ [exclude]
$ hg update
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ find * | sort
@@ -56,9 +56,9 @@
new changesets *:* (glob)
$ cd narrowdir
$ cat .hg/narrowspec
- [includes]
+ [include]
path:dir/tests
- [excludes]
+ [exclude]
path:dir/tests/t19
$ hg update
19 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -98,9 +98,9 @@
new changesets *:* (glob)
$ cd narrowroot
$ cat .hg/narrowspec
- [includes]
+ [include]
path:.
- [excludes]
+ [exclude]
path:dir/tests
$ hg update
20 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -13,6 +13,7 @@
from . import (
error,
match as matchmod,
+ sparse,
util,
)
@@ -107,10 +108,10 @@
return set(normalizepattern(p) for p in pats)
def format(includes, excludes):
- output = '[includes]\n'
+ output = '[include]\n'
for i in sorted(includes - excludes):
output += i + '\n'
- output += '[excludes]\n'
+ output += '[exclude]\n'
for e in sorted(excludes):
output += e + '\n'
return output
@@ -139,7 +140,9 @@
repo.invalidate(clearfilecache=True)
return set(), set()
raise
- return _parsestoredpatterns(spec)
+ # we should care about the profiles returned too
+ includepats, excludepats, __ = sparse.parseconfig(repo.ui, spec, 'narrow')
+ return includepats, excludepats
def save(repo, includepats, excludepats):
spec = format(includepats, excludepats)
To: pulkit, durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list