コード例 #1
0
        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));
        }
コード例 #2
0
ファイル: Config.cs プロジェクト: runt18/CvsntGitImporter
		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));
		}
コード例 #3
0
		public void CaseSensitive_MatchesCase()
		{
			var matcher = new InclusionMatcher(ignoreCase: false);
			matcher.AddIncludeRule(@"xx");

			var result = matcher.Match("XX");
			Assert.IsFalse(result);
		}
コード例 #4
0
		public void CaseInsensitive_IgnoresCase()
		{
			var matcher = new InclusionMatcher(ignoreCase: true);
			matcher.AddIncludeRule(@"xx");

			var result = matcher.Match("XX");
			Assert.IsTrue(result);
		}
コード例 #5
0
		public void AddExcludeRuleFirst_IncludesByDefault()
		{
			var matcher = new InclusionMatcher();
			matcher.AddExcludeRule(@"xx");

			var result = matcher.Match("blah");
			Assert.IsTrue(result);
		}
コード例 #6
0
		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);
		}
コード例 #7
0
 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);
     }
 }
コード例 #8
0
ファイル: Config.cs プロジェクト: runt18/CvsntGitImporter
		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);
			}
		}
コード例 #9
0
 public CvsLogParser(string sandboxPath, TextReader reader, InclusionMatcher branchMatcher)
     : this(sandboxPath, new CvsLogReader(reader), branchMatcher)
 {
 }
コード例 #10
0
 public CvsLogParser(string sandboxPath, string logFile, InclusionMatcher branchMatcher)
     : this(sandboxPath, new CvsLogReader(logFile), branchMatcher)
 {
 }
コード例 #11
0
 private CvsLogParser(string sandboxPath, CvsLogReader reader, InclusionMatcher branchMatcher)
 {
     m_sandboxPath   = sandboxPath;
     m_reader        = reader;
     m_branchMatcher = branchMatcher;
 }
コード例 #12
0
		public CvsLogParser(string sandboxPath, TextReader reader, InclusionMatcher branchMatcher)
			: this(sandboxPath, new CvsLogReader(reader), branchMatcher)
		{
		}
コード例 #13
0
		public CvsLogParser(string sandboxPath, string logFile, InclusionMatcher branchMatcher)
			: this(sandboxPath, new CvsLogReader(logFile), branchMatcher)
		{
		}
コード例 #14
0
		private CvsLogParser(string sandboxPath, CvsLogReader reader, InclusionMatcher branchMatcher)
		{
			m_sandboxPath = sandboxPath;
			m_reader = reader;
			m_branchMatcher = branchMatcher;
		}