D4057: narrowspec: use sparse.parseconfig() to parse narrowspec file (BC)

2018-08-03 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf64ebe7d2259: narrowspec: use sparse.parseconfig() to parse 
narrowspec file (BC) (authored by pulkit, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D4057?vs=9829=9869#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4057?vs=9829=9869

REVISION DETAIL
  https://phab.mercurial-scm.org/D4057

AFFECTED FILES
  mercurial/narrowspec.py
  tests/test-narrow-debugcommands.t

CHANGE DETAILS

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/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,13 @@
 repo.invalidate(clearfilecache=True)
 return set(), set()
 raise
-return _parsestoredpatterns(spec)
+# maybe we should care about the profiles returned too
+includepats, excludepats, profiles = sparse.parseconfig(repo.ui, spec,
+'narrow')
+if profiles:
+raise error.Abort(_("including other spec files using '%include' is 
not"
+" suported in narrowspec"))
+return includepats, excludepats
 
 def save(repo, includepats, excludepats):
 spec = format(includepats, excludepats)



To: pulkit, durin42, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4057: narrowspec: use sparse.parseconfig() to parse narrowspec file (BC)

2018-08-03 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  I've rebased this on top of https://phab.mercurial-scm.org/D4093 and resolved 
the conflicts (simply drop the changes from this patch). I'll push it once 
tests have finished.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4057

To: pulkit, durin42, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4057: narrowspec: use sparse.parseconfig() to parse narrowspec file (BC)

2018-08-03 Thread martinvonz (Martin von Zweigbergk)
martinvonz accepted this revision.
martinvonz added inline comments.
This revision is now accepted and ready to land.

INLINE COMMENTS

> narrowspec.py:145
> +includepats, excludepats, __ = sparse.parseconfig(repo.ui, spec, 
> 'narrow')
> +if __:
> +raise error.Abort(_("including other spec files using '%include' is 
> not"

I'll rename this to `profiles` in flight

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4057

To: pulkit, durin42, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4057: narrowspec: use sparse.parseconfig() to parse narrowspec file (BC)

2018-08-02 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> narrowspec.py:143
>  raise
> -return _parsestoredpatterns(spec)
> +# we should care about the profiles returned too
> +includepats, excludepats, __ = sparse.parseconfig(repo.ui, spec, 
> 'narrow')

We should at least abort if they're in there. I think we should add that check 
already in this patch.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4057

To: pulkit, durin42, #hg-reviewers
Cc: martinvonz, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel