# HG changeset patch # User Durham Goode # Date 2015-05-08 04:00:46 # Node ID e91b32d3c67b91e5ba0ff0f5b341930d64b6058a # Parent 8cf7f0c4cb142c070c3bb9461adb3cb037999aee 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. diff --git a/mercurial/ignore.py b/mercurial/ignore.py --- a/mercurial/ignore.py +++ b/mercurial/ignore.py @@ -40,15 +40,18 @@ def ignorepats(lines): 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