public static SvnLogInfo[] GetLogs(string path, string revision) { if (revision == null) { var logCommand = new SvnCommand("log") { (SvnPath)path, SvnCommandItem.FromRevision($"head:1"), SvnCommandItem.Xml, SvnCommandItem.Verbose, SvnCommandItem.FromMaxCount(MaxLogCount), SvnCommandItem.WithAllRevprops }; return(SvnLogInfo.Read(logCommand.Run())); } else { var logCommand = new SvnCommand("log") { (SvnPath)path, SvnCommandItem.FromRevision($"{revision}:1"), SvnCommandItem.Xml, SvnCommandItem.Verbose, SvnCommandItem.FromMaxCount(MaxLogCount), SvnCommandItem.WithAllRevprops }; return(SvnLogInfo.Read(logCommand.Run())); } }
public LogInfo[] GetLog(string basePath, string repositoryName, string revision) { var uri = this.GetUrl(basePath, repositoryName); var logs = SvnLogInfo.GetLogs(uri.ToString(), revision); return(logs.Select(item => (LogInfo)item).ToArray()); }
public static SvnLogInfo[] RunForGetBranch(Uri uri) { var logCommand = new SvnCommand("log") { (SvnPath)uri, SvnCommandItem.Xml, SvnCommandItem.Verbose, new SvnCommandItem("stop-on-copy") }; return(SvnLogInfo.Read(logCommand.Run())); }
public static SvnLogInfo GetFirstLog(string path) { var info = SvnInfo.Run(path); var revision = info.LastChangedRevision; var localPath = PathUtility.Separator + UriUtility.MakeRelativeOfDirectory(info.RepositoryRoot, info.Uri); while (revision != "1") { var logs = SvnLogInfo.Run(info.Uri.ToString(), "1", revision, 100); foreach (var item in logs) { var renamed = false; foreach (var changedPath in item.ChangedPaths) { if (changedPath.Action == "A" && changedPath.Path == localPath) { localPath = changedPath.CopyFromPath; renamed = true; break; } } var deleted = false; if (renamed == true) { foreach (var changedPath in item.ChangedPaths) { if (changedPath.Action == "D" && changedPath.Path == localPath) { deleted = true; break; } } if (deleted == false) { return(item); } } } if (logs.Count() == 1) { return(logs.First()); } else { revision = logs.Last().Revision; } } return(SvnLogInfo.GetLogs(info.Uri.ToString(), "1").First()); }
private static SvnLogInfo Parse(XElement element) { LogPropertyInfo[] props = null; var commentValue = element.XPathSelectElement("msg").Value; var comment = null as string; var obj = new SvnLogInfo() { Author = element.XPathSelectElement("author").Value, Revision = element.Attribute("revision").Value, Comment = comment ?? commentValue, DateTime = XmlConvert.ToDateTime(element.XPathSelectElement("date").Value, XmlDateTimeSerializationMode.Utc) }; var pathItems = element.XPathSelectElements("paths/path").ToArray(); var changedItemList = new List <SvnChangeInfo>(); foreach (var item in pathItems) { var changedItem = SvnChangeInfo.Parse(item); changedItemList.Add(changedItem); } obj.ChangedPaths = changedItemList.ToArray(); if (props == null) { var propItems = element.XPathSelectElements("revprops/property").ToArray(); var propItemList = new List <SvnPropertyValue>(); foreach (var item in propItems) { var propItem = SvnPropertyValue.Parse(item); propItemList.Add(propItem); if (propItem.Prefix == propertyPrefix && propItem.Key == LogPropertyInfo.UserIDKey) { obj.Author = propItem.Value; } } obj.Properties = propItemList.ToArray(); } else { var propList = new List <SvnPropertyValue>(); foreach (var item in props) { propList.Add((SvnPropertyValue)item); } obj.Properties = propList.ToArray(); } return(obj); }
public static SvnLogInfo GetLatestLog(string path) { var logCommand = new SvnCommand("log") { (SvnPath)path, SvnCommandItem.FromRevision($"head:1"), SvnCommandItem.Xml, SvnCommandItem.Verbose, SvnCommandItem.FromMaxCount(1), SvnCommandItem.WithAllRevprops }; return(SvnLogInfo.Read(logCommand.Run()).First()); }
public static SvnLogInfo[] Run(string path, string minRevision, string maxRevision, int count) { var logCommand = new SvnCommand("log") { (SvnPath)path, SvnCommandItem.FromRevision($"{maxRevision}:{minRevision}"), SvnCommandItem.Xml, SvnCommandItem.Verbose, SvnCommandItem.FromMaxCount(count), SvnCommandItem.WithAllRevprops, }; return(SvnLogInfo.Read(logCommand.Run())); }
public RepositoryInfo GetRepositoryInfo(string basePath, string repositoryName) { var uri = this.GetUrl(basePath, repositoryName); var latestLog = SvnLogInfo.GetLatestLog($"{uri}"); var firstLog = SvnLogInfo.GetFirstLog($"{uri}"); var repositoryInfo = new RepositoryInfo() { ID = GuidUtility.FromName(repositoryName + firstLog.Revision), Name = repositoryName, Comment = firstLog.Comment, Revision = latestLog.Revision, CreationInfo = new SignatureDate(firstLog.Author, firstLog.DateTime), ModificationInfo = new SignatureDate(latestLog.Author, latestLog.DateTime), }; return(repositoryInfo); }
public static SvnLogInfo[] Read(string text) { var logItemList = new List <SvnLogInfo>(); using (var sr = new StringReader(text)) { var doc = XDocument.Load(sr); var logItems = doc.XPathSelectElements("/log/logentry"); foreach (var item in logItems) { var logItem = SvnLogInfo.Parse(item); logItemList.Add(logItem); } } return(logItemList.ToArray()); }
public static SvnLogInfo[] GetLogs(string[] paths, string revision) { var logCommand = new SvnCommand("log") { SvnCommandItem.FromRevision($"{revision ?? "head"}:1"), SvnCommandItem.Xml, SvnCommandItem.Verbose, SvnCommandItem.FromMaxCount(MaxLogCount), SvnCommandItem.WithAllRevprops, }; foreach (var item in paths) { logCommand.Add((SvnPath)item); } return(SvnLogInfo.Read(logCommand.Run())); }
public LogInfo[] GetLog(string[] paths, string revision) { var logs = SvnLogInfo.GetLogs(paths, revision); return(logs.Select(item => (LogInfo)item).ToArray()); }