public void Add(VssActionType action) { if (this.operations.ContainsKey(action)) { this.operations[action]++; } else { this.operations.Add(action, 1); } this.count++; }
private bool WriteRevision(VssPathMapper pathMapper, VssActionType actionType, string physicalName, int version, string underProject, GitWrapper git) { var needCommit = false; var paths = pathMapper.GetFilePaths(physicalName, underProject); foreach (string path in paths) { logger.WriteLine("{0}: {1} revision {2}", path, actionType, version); if (WriteRevisionTo(physicalName, version, path)) { // add file explicitly, so it is visible to subsequent git operations git.Add(path); needCommit = true; } } return(needCommit); }
private void WriteRevision(VssPathMapper pathMapper, VssActionType actionType, string physicalName, int version, string underProject) { var paths = pathMapper.GetFilePaths(physicalName, underProject); if (!paths.Any()) { logger.WriteLine("WARNING: {0}: no physical path, {1} revision {2} skipped", physicalName, actionType, version); } foreach (string path in paths) { logger.WriteLine("{0}: {1} revision {2}", path, actionType, version); if (WriteRevisionTo(physicalName, version, path)) { // add file explicitly, so it is visible to subsequent vcs operations vcsWrapper.Add(path); } } }
private bool WriteRevision(VssPathMapper pathMapper, VssActionType actionType, string physicalName, int version, string underProject, GitWrapper git) { var needCommit = false; var paths = pathMapper.GetFilePaths(physicalName, underProject); foreach (string path in paths) { logger.WriteLine("{0}: {1} revision {2}", path, actionType, version); if (WriteRevisionTo(physicalName, version, path)) { // add file explicitly, so it is visible to subsequent git operations git.Add(path); needCommit = true; } } return needCommit; }
private Revision FindCorrespondingAction(Revision rev, VssActionType actionType) { if (rev.Action.Type != VssActionType.Edit && rev.Action.Type != VssActionType.Label) { var action = rev.Action as VssNamedAction; for (var node = revisionAnalyzer.SortedRevisions[rev.DateTime].Last; node != revisionAnalyzer.SortedRevisions[rev.DateTime].First.Previous; node = node.Previous) { var revision = node.Value; if (revision.Action.Type != VssActionType.Edit && revision.Action.Type != VssActionType.Label) { var targetaction = revision.Action as VssNamedAction; if (action.Name.PhysicalName == targetaction.Name.PhysicalName && targetaction.Type == actionType && revision.Comment != null) { return(revision); } } } // look into sortedrevisions for the comment var foundPrevKey = false; var foundNextKey = false; var prevKey = (DateTime)DateTime.MinValue; var nextKey = (DateTime)DateTime.MinValue; foreach (var key in revisionAnalyzer.SortedRevisions.Keys) { if (key == rev.DateTime) { foundPrevKey = true; } else if (foundPrevKey) { foundNextKey = true; nextKey = key; break; } if (!foundPrevKey) { prevKey = key; } } if (foundPrevKey && rev.DateTime - prevKey < TimeSpan.FromMinutes(15)) { for (var node = revisionAnalyzer.SortedRevisions[prevKey].Last; node != revisionAnalyzer.SortedRevisions[prevKey].First.Previous; node = node.Previous) { var revision = node.Value; if (revision.Action.Type != VssActionType.Edit && revision.Action.Type != VssActionType.Label) { var targetaction = revision.Action as VssNamedAction; if (action.Name.PhysicalName == targetaction.Name.PhysicalName && targetaction.Type == actionType && revision.Comment != null) { return(revision); } } } } if (foundNextKey && nextKey - rev.DateTime < TimeSpan.FromMinutes(15)) { for (var node = revisionAnalyzer.SortedRevisions[nextKey].First; node != revisionAnalyzer.SortedRevisions[nextKey].Last.Next; node = node.Next) { var revision = node.Value; if (revision.Action.Type != VssActionType.Edit && revision.Action.Type != VssActionType.Label) { var targetaction = revision.Action as VssNamedAction; if (action.Name.PhysicalName == targetaction.Name.PhysicalName && targetaction.Type == actionType && revision.Comment != null) { return(revision); } } } } } return(null); }
private Revision FindCorrespondingAction(Revision rev, VssActionType actionType) { if (rev.Action.Type != VssActionType.Edit && rev.Action.Type != VssActionType.Label) { var action = rev.Action as VssNamedAction; for (var node = revisionAnalyzer.SortedRevisions[rev.DateTime].Last; node != revisionAnalyzer.SortedRevisions[rev.DateTime].First.Previous; node = node.Previous) { var revision = node.Value; if (revision.Action.Type != VssActionType.Edit && revision.Action.Type != VssActionType.Label) { var targetaction = revision.Action as VssNamedAction; if (action.Name.PhysicalName == targetaction.Name.PhysicalName && targetaction.Type == actionType && revision.Comment != null) return revision; } } // look into sortedrevisions for the comment var foundPrevKey = false; var foundNextKey = false; var prevKey = (DateTime)DateTime.MinValue; var nextKey = (DateTime)DateTime.MinValue; foreach (var key in revisionAnalyzer.SortedRevisions.Keys) { if (key == rev.DateTime) { foundPrevKey = true; } else if (foundPrevKey) { foundNextKey = true; nextKey = key; break; } if (!foundPrevKey) prevKey = key; } if (foundPrevKey && rev.DateTime - prevKey < TimeSpan.FromMinutes(15)) for (var node = revisionAnalyzer.SortedRevisions[prevKey].Last; node != revisionAnalyzer.SortedRevisions[prevKey].First.Previous; node = node.Previous) { var revision = node.Value; if (revision.Action.Type != VssActionType.Edit && revision.Action.Type != VssActionType.Label) { var targetaction = revision.Action as VssNamedAction; if (action.Name.PhysicalName == targetaction.Name.PhysicalName && targetaction.Type == actionType && revision.Comment != null) return revision; } } if (foundNextKey && nextKey - rev.DateTime < TimeSpan.FromMinutes(15)) for (var node = revisionAnalyzer.SortedRevisions[nextKey].First; node != revisionAnalyzer.SortedRevisions[nextKey].Last.Next; node = node.Next) { var revision = node.Value; if (revision.Action.Type != VssActionType.Edit && revision.Action.Type != VssActionType.Label) { var targetaction = revision.Action as VssNamedAction; if (action.Name.PhysicalName == targetaction.Name.PhysicalName && targetaction.Type == actionType && revision.Comment != null) return revision; } } } return null; }