public Config(Switches switches) { m_switches = switches; m_debugLogDir = Path.Combine(Environment.CurrentDirectory, "DebugLogs"); ObserveCollection(m_switches.GitConfigSet, x => AddGitConfigOption(x, add: false)); ObserveCollection(m_switches.GitConfigAdd, x => AddGitConfigOption(x, add: true)); TagMatcher = new InclusionMatcher(ignoreCase: false); TagRename = new Renamer(); BranchMatcher = new InclusionMatcher(ignoreCase: false); BranchRename = new Renamer(); BranchRename.AddRule(new RenameRule("^MAIN$", "master")); ObserveCollection(m_switches.IncludeFile, x => AddIncludeRule(m_fileMatcher, x, include: true)); ObserveCollection(m_switches.ExcludeFile, x => AddIncludeRule(m_fileMatcher, x, include: false)); ObserveCollection(m_switches.HeadOnly, x => AddIncludeRule(m_headOnlyMatcher, x, include: true)); ObserveCollection(m_switches.IncludeTag, x => AddIncludeRule(TagMatcher, x, include: true)); ObserveCollection(m_switches.ExcludeTag, x => AddIncludeRule(TagMatcher, x, include: false)); ObserveCollection(m_switches.RenameTag, x => AddRenameRule(TagRename, x)); ObserveCollection(m_switches.IncludeBranch, x => AddIncludeRule(BranchMatcher, x, include: true)); ObserveCollection(m_switches.ExcludeBranch, x => AddIncludeRule(BranchMatcher, x, include: false)); ObserveCollection(m_switches.RenameBranch, x => AddRenameRule(BranchRename, x)); }
public Config(Switches switches) { m_switches = switches; m_debugLogDir = Path.Combine(Environment.CurrentDirectory, "DebugLogs"); ObserveCollection(m_switches.GitConfigSet, x => AddGitConfigOption(x, add: false)); ObserveCollection(m_switches.GitConfigAdd, x => AddGitConfigOption(x, add: true)); TagMatcher = new InclusionMatcher(ignoreCase: false); TagRename = new Renamer(); BranchMatcher = new InclusionMatcher(ignoreCase: false); BranchRename = new Renamer(); BranchRename.AddRule(new RenameRule("^MAIN$", "master")); ObserveCollection(m_switches.IncludeFile, x => AddIncludeRule(m_fileMatcher, x, include: true)); ObserveCollection(m_switches.ExcludeFile, x => AddIncludeRule(m_fileMatcher, x, include: false)); ObserveCollection(m_switches.HeadOnly, x => AddIncludeRule(m_headOnlyMatcher, x, include:true)); ObserveCollection(m_switches.IncludeTag, x => AddIncludeRule(TagMatcher, x, include: true)); ObserveCollection(m_switches.ExcludeTag, x => AddIncludeRule(TagMatcher, x, include: false)); ObserveCollection(m_switches.RenameTag, x => AddRenameRule(TagRename, x)); ObserveCollection(m_switches.IncludeBranch, x => AddIncludeRule(BranchMatcher, x, include: true)); ObserveCollection(m_switches.ExcludeBranch, x => AddIncludeRule(BranchMatcher, x, include: false)); ObserveCollection(m_switches.RenameBranch, x => AddRenameRule(BranchRename, x)); }
public void CaseSensitive_MatchesCase() { var matcher = new InclusionMatcher(ignoreCase: false); matcher.AddIncludeRule(@"xx"); var result = matcher.Match("XX"); Assert.IsFalse(result); }
public void CaseInsensitive_IgnoresCase() { var matcher = new InclusionMatcher(ignoreCase: true); matcher.AddIncludeRule(@"xx"); var result = matcher.Match("XX"); Assert.IsTrue(result); }
public void AddExcludeRuleFirst_IncludesByDefault() { var matcher = new InclusionMatcher(); matcher.AddExcludeRule(@"xx"); var result = matcher.Match("blah"); Assert.IsTrue(result); }
public void AddIncludeThenExclude_Matches() { var matcher = new InclusionMatcher(); matcher.AddIncludeRule(@"xx"); matcher.AddExcludeRule(@"yy"); var result = matcher.Match("aaxx"); Assert.IsTrue(result); result = matcher.Match("xxyy"); Assert.IsFalse(result); }
private void AddIncludeRule(InclusionMatcher matcher, string pattern, bool include) { try { if (include) { matcher.AddIncludeRule(pattern); } else { matcher.AddExcludeRule(pattern); } } catch (ArgumentException) { throw new CommandLineArgsException("Invalid regex: {0}", pattern); } }
private void AddIncludeRule(InclusionMatcher matcher, string pattern, bool include) { try { if (include) matcher.AddIncludeRule(pattern); else matcher.AddExcludeRule(pattern); } catch (ArgumentException) { throw new CommandLineArgsException("Invalid regex: {0}", pattern); } }
public CvsLogParser(string sandboxPath, TextReader reader, InclusionMatcher branchMatcher) : this(sandboxPath, new CvsLogReader(reader), branchMatcher) { }
public CvsLogParser(string sandboxPath, string logFile, InclusionMatcher branchMatcher) : this(sandboxPath, new CvsLogReader(logFile), branchMatcher) { }
private CvsLogParser(string sandboxPath, CvsLogReader reader, InclusionMatcher branchMatcher) { m_sandboxPath = sandboxPath; m_reader = reader; m_branchMatcher = branchMatcher; }