internal static SVNLog GetLog(Source source, long startRevision) { Collection<SvnLogEventArgs> collection; SharpSVNClient.GetLog(source, startRevision, out collection); SVNLog log = new SVNLog(); if ((collection.Count != 1) || (collection[0].Revision != source.Revision)) { SVNInfo info = GetInfo(source); Collection<SvnStatusEventArgs> statusCollection = null; if (!source.IsURL) { statusCollection = GetStatusCollection(source, false, true); } log = SharpSVNToSVNLog(source, collection, info, statusCollection); } log.Source = source; return log; }
private static SVNLog SharpSVNToSVNLog(Source source, Collection<SvnLogEventArgs> collection, SVNInfo info, Collection<SvnStatusEventArgs> statusCollection) { SVNLog log = new SVNLog(); Dictionary<string, SvnStatusEventArgs> statusMap = GetStatusMap(statusCollection); foreach (SvnLogEventArgs logItem in collection) { DateTime localTime = logItem.Time.ToLocalTime(); SVNLogEntry entry = new SVNLogEntry(source, logItem.Revision, logItem.Author, localTime, logItem.LogMessage); SvnChangeItemCollection items = logItem.ChangedPaths; if (items != null) { List<SVNPath> paths = new List<SVNPath>(); foreach (SvnChangeItem item in items) { SVNPath path = new SVNPath(entry, SVNActionConverter.ToSVNAction(item.Action), item.Path); string pathName = item.Path; if (pathName.StartsWith("/")) { pathName = pathName.Substring(1); } string pathUri = info.RepositoryRoot + pathName; path.Uri = pathUri; if (statusMap.ContainsKey(pathUri)) { SvnStatusEventArgs statusItem = statusMap[pathUri]; path.FilePath = statusItem.FullPath; } else { string filePath = SVNPath.GuessFilePath(entry, path.Name, info); if (FileSystemHelper.Exists(filePath)) { path.FilePath = filePath; } else { path.FilePath = pathUri; } } paths.Add(path); } entry.Paths = paths; log.LogEntries.Add(entry); } } return log; }
private void Reset() { revision = 0L; Info = null; if (Log != null) { Log.Delete(); } log = null; hasLog = false; LocalStatus = null; pathExists = null; isURL = null; isFileURL = null; }
internal void SetLog(SVNLog log) { this.log = log; hasLog = log != null; ClearError(); }
public string OnCommitFinished( IntPtr hParentWnd, string commonRoot, string[] pathList, string logMessage, int revision) { SVNLog log = new SVNLog(); log.files = pathList; log.repoRoot = repoRoot; log.repoUrl = repoUrl; log.revision = Convert.ToString(revision); log.message = logMessage; bool isMatched = false; string bugReg = "(Fix\\s+)?[Bb]ug#(\\d+)"; MatchCollection matches = Regex.Matches(logMessage, bugReg); string resText = ""; foreach(Match match in matches){ string operate = match.Groups[1].Value; string bugId = match.Groups[2].Value; //任务完成 if (match.Groups[1].Success) { resText += "Bug#" + bugId + "已解决\r\n"; zenTaoManage.updateBug(bugId, ""); isMatched = true; } } string taskReg = "(Finish\\s+)?[Tt]ask#(\\d+).*?,\\s*[Cc]ost:(\\d+)\\s*left:(\\d+)"; matches = Regex.Matches(logMessage, taskReg); foreach(Match match in matches){ string operate = match.Groups[1].Value; string taskId = match.Groups[2].Value; string consumed = match.Groups[3].Value; string left = match.Groups[4].Value; TaskInfo task = issForm.queryTaskById(taskId); zenTaoManage.updateTask(task); isMatched = true; if (match.Groups[1].Success) { resText += "Task#" + taskId + "," + taskId + ", " + consumed + ", " + left + "已完成\r\n"; } } if (isMatched) { zenTaoManage.saveSVNLog(log); } return resText; }