Mercurial > hg4j
changeset 564:e6407313bab7
Recognize re: in-line prefix for regular expressions as native client does, despite silence in hgingore.5
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 03 Apr 2013 21:28:06 +0200 |
parents | ca56a36c2eea |
children | 78a9e26e670d |
files | src/org/tmatesoft/hg/repo/HgIgnore.java |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgIgnore.java Thu Feb 28 16:34:33 2013 +0100 +++ b/src/org/tmatesoft/hg/repo/HgIgnore.java Wed Apr 03 21:28:06 2013 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 TMate Software Ltd + * Copyright (c) 2010-2013 TMate Software Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,7 +59,7 @@ /* package-local */ List<String> read(BufferedReader content) throws IOException { final String REGEXP = "regexp", GLOB = "glob"; - final String REGEXP_PREFIX = REGEXP + ":", GLOB_PREFIX = GLOB + ":"; + final String REGEXP_PREFIX1 = REGEXP + ":", REGEXP_PREFIX2 = "re:", GLOB_PREFIX = GLOB + ":"; ArrayList<String> errors = new ArrayList<String>(); ArrayList<Pattern> result = new ArrayList<Pattern>(entries); // start with existing String syntax = REGEXP; @@ -94,8 +94,11 @@ if (line.startsWith(GLOB_PREFIX)) { line = line.substring(GLOB_PREFIX.length()).trim(); lineSyntax = GLOB; - } else if (line.startsWith(REGEXP_PREFIX)) { - line = line.substring(REGEXP_PREFIX.length()).trim(); + } else if (line.startsWith(REGEXP_PREFIX1)) { + line = line.substring(REGEXP_PREFIX1.length()).trim(); + lineSyntax = REGEXP; + } else if (line.startsWith(REGEXP_PREFIX2)) { + line = line.substring(REGEXP_PREFIX2.length()).trim(); lineSyntax = REGEXP; } else { lineSyntax = syntax;