Mercurial > hg
comparison hgext/narrow/narrowspec.py @ 36098:9c55bbc29dcf
narrowspec: document constraints when validating patterns
Differential Revision: https://phab.mercurial-scm.org/D2190
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 12 Feb 2018 14:27:32 -0500 |
parents | a2a6e724d61a |
children | b8bbe589fd47 |
comparison
equal
deleted
inserted
replaced
36097:66b4ffe90676 | 36098:9c55bbc29dcf |
---|---|
81 # compatible. However, it does not count empty lines at the end, so trick | 81 # compatible. However, it does not count empty lines at the end, so trick |
82 # it by adding a character at the end. | 82 # it by adding a character at the end. |
83 return len((s + 'x').splitlines()) | 83 return len((s + 'x').splitlines()) |
84 | 84 |
85 def _validatepattern(pat): | 85 def _validatepattern(pat): |
86 """Validates the pattern and aborts if it is invalid.""" | 86 """Validates the pattern and aborts if it is invalid. |
87 | |
88 Patterns are stored in the narrowspec as newline-separated | |
89 POSIX-style bytestring paths. There's no escaping. | |
90 """ | |
87 | 91 |
88 # We use newlines as separators in the narrowspec file, so don't allow them | 92 # We use newlines as separators in the narrowspec file, so don't allow them |
89 # in patterns. | 93 # in patterns. |
90 if _numlines(pat) > 1: | 94 if _numlines(pat) > 1: |
91 raise error.Abort('newlines are not allowed in narrowspec paths') | 95 raise error.Abort('newlines are not allowed in narrowspec paths') |