##// END OF EJS Templates
narrowspec: validate patterns when loading and saving spec file...
Gregory Szorc -
r39575:8d8e61df default
parent child Browse files
Show More
@@ -164,9 +164,15 b' def load(repo):'
164 if profiles:
164 if profiles:
165 raise error.Abort(_("including other spec files using '%include' is not"
165 raise error.Abort(_("including other spec files using '%include' is not"
166 " supported in narrowspec"))
166 " supported in narrowspec"))
167
168 validatepatterns(includepats)
169 validatepatterns(excludepats)
170
167 return includepats, excludepats
171 return includepats, excludepats
168
172
169 def save(repo, includepats, excludepats):
173 def save(repo, includepats, excludepats):
174 validatepatterns(includepats)
175 validatepatterns(excludepats)
170 spec = format(includepats, excludepats)
176 spec = format(includepats, excludepats)
171 repo.svfs.write(FILENAME, spec)
177 repo.svfs.write(FILENAME, spec)
172
178
@@ -439,3 +439,31 b' Illegal patterns are rejected'
439 abort: invalid prefix on narrow pattern: set:ignored
439 abort: invalid prefix on narrow pattern: set:ignored
440 (narrow patterns must begin with one of the following: path:, rootfilesin:)
440 (narrow patterns must begin with one of the following: path:, rootfilesin:)
441 [255]
441 [255]
442
443 $ cat .hg/store/narrowspec
444 [include]
445 path:dir1
446 path:dir1/dirA
447 [exclude]
448
449 $ cat > .hg/store/narrowspec << EOF
450 > [include]
451 > glob:**
452 > EOF
453
454 $ hg tracked
455 abort: invalid prefix on narrow pattern: glob:**
456 (narrow patterns must begin with one of the following: path:, rootfilesin:)
457 [255]
458
459 $ cat > .hg/store/narrowspec << EOF
460 > [include]
461 > path:.
462 > [exclude]
463 > set:ignored
464 > EOF
465
466 $ hg tracked
467 abort: invalid prefix on narrow pattern: set:ignored
468 (narrow patterns must begin with one of the following: path:, rootfilesin:)
469 [255]
General Comments 0
You need to be logged in to leave comments. Login now