Mercurial > hg
changeset 25066:e91b32d3c67b
ignore: refactor syntax concatenation
This refactors the syntax+rule concatenation logic to be more separated. It
determines the syntax and the rule separately and then puts them back together.
This will help in a later patch when we want to process just the rule before it
gets concatenated.
author | Durham Goode <durham@fb.com> |
---|---|
date | Thu, 07 May 2015 21:00:46 -0700 |
parents | 8cf7f0c4cb14 |
children | f52c5701925a |
files | mercurial/ignore.py |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/ignore.py Thu May 07 20:57:37 2015 -0700 +++ b/mercurial/ignore.py Thu May 07 21:00:46 2015 -0700 @@ -40,15 +40,18 @@ except KeyError: warnings.append(_("ignoring invalid syntax '%s'") % s) continue - pat = syntax + line + + linesyntax = syntax for s, rels in syntaxes.iteritems(): if line.startswith(rels): - pat = line + linesyntax = rels + line = line[len(rels):] break elif line.startswith(s+':'): - pat = rels + line[len(s) + 1:] + linesyntax = rels + line = line[len(s) + 1:] break - patterns.append(pat) + patterns.append(linesyntax + line) return patterns, warnings