diff tests/test-sparse-profiles.t @ 33551:1d1779734c99

sparse: require [section] in sparse config files (BC) Previously, [include] was implicit and pattern lines before a [section] were added to includes. Because the format may change in the future and explicit behavior, well, more explicit, this commit changes the config parser to reject pattern lines that don't occur in a [section]. Differential Revision: https://phab.mercurial-scm.org/D96
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 15 Jul 2017 13:21:23 -0700
parents de324547c751
children 41ef02ba329b
line wrap: on
line diff
--- a/tests/test-sparse-profiles.t	Sat Jul 15 13:07:57 2017 -0700
+++ b/tests/test-sparse-profiles.t	Sat Jul 15 13:21:23 2017 -0700
@@ -10,6 +10,18 @@
   > rebase=
   > EOF
 
+Config file without [section] is rejected
+
+  $ cat > bad.sparse <<EOF
+  > *.html
+  > EOF
+
+  $ hg debugsparse --import-rules bad.sparse
+  abort: sparse config entry outside of section: *.html
+  (add an [include] or [exclude] line to declare the entry type)
+  [255]
+  $ rm bad.sparse
+
   $ echo a > index.html
   $ echo x > data.py
   $ echo z > readme.txt
@@ -257,6 +269,7 @@
   > EOF
   $ touch a b
   $ cat > .hgsparse <<EOF
+  > [include]
   > a
   > EOF
   $ hg commit -Aqm 'initial'