void ExecuteDiff(CommandEventArgs e, ICollection <SvnOrigin> targets, SvnRevisionRange range) { if (targets.Count != 1) { return; } SvnTarget diffTarget = EnumTools.GetSingle(targets).Target; IAnkhDiffHandler diff = e.GetService <IAnkhDiffHandler>(); AnkhDiffArgs da = new AnkhDiffArgs(); string[] files = diff.GetTempFiles(diffTarget, range.StartRevision, range.EndRevision, true); if (files == null) { return; } da.BaseFile = files[0]; da.MineFile = files[1]; da.BaseTitle = diff.GetTitle(diffTarget, range.StartRevision); da.MineTitle = diff.GetTitle(diffTarget, range.EndRevision); da.ReadOnly = true; diff.RunDiff(da); }
public void ForEachChild(string path, int revision, Change change, Action <PathChange> action) { SvnClient client = AllocSvnClient(); SvnTarget target = MakeTarget(path, change == Change.Delete ? revision - 1 : revision); try { SvnListArgs args = new SvnListArgs { Depth = SvnDepth.Infinity }; client.List(target, args, delegate(object s, SvnListEventArgs e) { if (string.IsNullOrEmpty(e.Path)) { return; } var pc = new PathChange(); { pc.Change = change; pc.Revision = revision; // to be compatible with the log output (which has no trailing '/' for directories) // we need to remove trailing '/' pc.Path = (e.BasePath.EndsWith("/") ? e.BasePath : e.BasePath + "/") + e.Path.TrimEnd('/'); } action(pc); }); } finally { FreeSvnClient(client); } }
/// <summary> /// /// </summary> /// <param name="strFileName"></param> /// <param name="strError"></param> /// <returns></returns> public SvnInfoEventArgs GetTargetInformation(string strFileName, ref string strError) { try { // Create Target Information SvnTarget target = SvnTarget.FromString(strFileName); SvnInfoEventArgs args; // Get Target Information bool boolRetrievedInfo = this.Connection.GetInfo(target, out args); // Validation if (boolRetrievedInfo == false || args == null) { return(null); } return(args); } catch (Exception ex) { strError = ex.ToString(); Console.WriteLine(strError); return(null); } }
private void CopyProperties(SvnTarget source, string destinationPath) { Collection <SvnPropertyListEventArgs> props; _g.Svn.GetPropertyList(source, out props); var keys = new HashSet <string>(); foreach (var prop in props) { foreach (var p in prop.Properties) { var key = p.Key; keys.Add(key); _g.Svn.SetProperty(destinationPath, key, p.RawValue); _g.Interaction.Trace("\t\tSet {0}=>{1}", key, p.StringValue); } } _g.Svn.GetPropertyList(new SvnPathTarget(destinationPath), out props); foreach (var prop in props) { foreach (var p in prop.Properties) { var key = p.Key; if (keys.Contains(key)) { continue; } _g.Svn.DeleteProperty(destinationPath, key); _g.Interaction.Trace("\t\tDelete {0}", key); } } }
/// <summary> /// Returns a list of the contents of the directory /// </summary> /// <param name="svnTarget"></param> /// <returns></returns> public static Collection<SvnListEventArgs> FetchListing(SvnTarget svnTarget, SvnListArgs args = null) { args = args == null ? new SvnListArgs() : args; var result = new Collection<SvnListEventArgs>(); _client.Value.GetList(svnTarget, args, out result); return result; }
internal bool CreateBranch(SvnListEventArgs selectedTag, string branchName) { try { if (selectedTag != null) { using (SvnClient client = new SvnClient()) { // Bind the SharpSvn UI to our client for SSL certificate and credentials SvnUIBindArgs bindArgs = new SvnUIBindArgs(); SvnUI.Bind(client, bindArgs); string relativeComponentPath = string.Join(string.Empty, selectedTag.BaseUri.Segments.Take(selectedTag.BaseUri.Segments.Count() - 1).ToArray()); string server = selectedTag.BaseUri.GetComponents(UriComponents.SchemeAndServer, UriFormat.SafeUnescaped); Uri barnchUri = new Uri(server + relativeComponentPath + "branches/project/" + branchName); SvnTarget source = SvnTarget.FromUri(selectedTag.Uri); SvnCopyArgs arg = new SvnCopyArgs(); arg.CreateParents = false; arg.LogMessage = string.Format("ADMIN-0: Branch Created from Tag {0}", selectedTag.Name); return(client.RemoteCopy(source, barnchUri, arg)); } } return(false); } catch (Exception) { throw; } }
private MemoryStream GetSVNFileStream(SvnRevisionId changeset, string path) { var memoryStream = new MemoryStream(); SvnTarget target; //If you use Uri you should encode '#' as %23, as Uri's define the # as Fragment separator. //And in this case the fragment is not send to the server. path = path.Replace("#", "%23"); if (SvnTarget.TryParse(GetPath(path).AbsolutePath, out target)) { if (FileWasDeleted(path, changeset)) { return(new MemoryStream()); } var uriTarget = new SvnUriTarget(_root + path, changeset.Value); var svnWriteArgs = new SvnWriteArgs { Revision = changeset.Value }; Client.Write(uriTarget, memoryStream, svnWriteArgs); return(memoryStream); } return(new MemoryStream()); }
public CommitDiff GetRevisionDiffs(long revision) { CommitDiff result = null; SvnChangeHandler handler = new SvnChangeHandler(); using (SvnClient svnClient = new SvnClient()) { svnClient.LoadConfiguration(Path.Combine(Path.GetTempPath(), "Svn"), true); svnClient.Authentication.ForceCredentials(Username, Password); svnClient.Log( RemoteRepro, new SvnLogArgs() { Range = new SvnRevisionRange(revision, revision) }, handler.Handler); SvnTarget target = SvnTarget.FromUri(RemoteRepro); using (MemoryStream ms = new MemoryStream()) { svnClient.Diff(target, new SvnRevisionRange(revision - 1, revision), ms); ms.Position = 0; StreamReader reader = new StreamReader(ms); result = GetRevisionDiffs(revision, handler.FileChanges, reader); } } return(result); }
public void My_Load() { svn.Authentication.UserNamePasswordHandlers += new EventHandler <SharpSvn.Security.SvnUserNamePasswordEventArgs>( delegate(Object s, SharpSvn.Security.SvnUserNamePasswordEventArgs e1) { e1.UserName = GlobalVariable.svnUserName; e1.Password = GlobalVariable.svnPassword; }); dir = redis.Get <string>(RedisKeyName.svnBaseDirKey); SvnTarget repos = (SvnTarget)dir; Collection <SvnListEventArgs> list = new Collection <SvnListEventArgs>(); try { if (svn.GetList(repos, out list)) { list.RemoveAt(0); foreach (var file in list) { TreeViewItem item = new TreeViewItem(); item.Header = file.Name; item.Tag = dir + file.Name; item.Items.Add(_dummyNode); item.Expanded += folder_Expanded; TreeViewItemProps.SetFileType(item, "folder"); folderTree.Items.Add(item); } } } catch (SvnException ex) { MessageBox.Show(ex.Message, ex.Source, MessageBoxButton.OK, MessageBoxImage.Warning); this.Close(); } }
public static string GetInfo(string[] args, string revision) { Parameters parameters; if (!Parameters.TryParse(args, out parameters)) { return("False"); } using (var client = new SharpSvn.SvnClient()) { SetUpClient(parameters, client); var target = SvnTarget.FromString(parameters.Path); SvnInfoEventArgs svnInfoEventArgs; SvnUpdateResult svnUpdateResult; if (!client.GetInfo(target, out svnInfoEventArgs)) { throw new Exception("SVN info failed"); } Uri svnUrl = svnInfoEventArgs.Uri; return(svnInfoEventArgs.Revision.ToString()); throw new Exception("SVN update failed"); } return("jhgjg"); }
static IEnumerable <DirectoryEntry> List(SvnTarget target, bool recurse) { var list = new List <DirectoryEntry> (); var args = new SvnListArgs { Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children, }; lock (client) client.List(target, args, delegate(object o, SvnListEventArgs a) { if (string.IsNullOrEmpty(a.Path)) { return; } list.Add(new DirectoryEntry { CreatedRevision = ToBaseRevision(a.Entry.Revision).Rev, HasProps = a.Entry.HasProperties, IsDirectory = a.Entry.NodeKind == SvnNodeKind.Directory, LastAuthor = a.Entry.Author, Name = a.Path, Size = a.Entry.FileSize, Time = a.Entry.Time, }); }); return(list); }
public string Search(string path, bool recurseUp, string propName) { if (!String.IsNullOrEmpty(_base)) { path = Path.Combine(_base, path); } if (!Directory.Exists(path)) { if (!File.Exists(path)) { throw new FileNotFoundException(path); } path = Path.GetDirectoryName(path); } using (var client = new SvnClient()) { string result; Guid guid; do { client.TryGetProperty(SvnTarget.FromString(path), propName, out result); Debug.Assert(path != null, "path != null"); path = Directory.GetParent(path).FullName; } while (result == null && recurseUp && client.TryGetRepositoryId(path, out guid)); return(result ?? string.Empty); } }
public override Revision GetRevision(string alias) { string url = Url.TrimEnd('/'); string tempFolder = Context.Current.MapPath(Core.Settings.rootPath + "/svnRepoTemp/"); if (System.IO.Directory.Exists(tempFolder)) { System.IO.Directory.Delete(tempFolder); } using (SvnClient client = new SvnClient()) { client.LoadConfiguration("path"); client.Authentication.DefaultCredentials = new NetworkCredential(Login, Password); SvnTarget folderTarget = SvnTarget.FromString(url); client.Export(folderTarget, tempFolder); RevisionStorage rs = new RevisionStorage(); var r = rs.GetFromDirectory(alias, tempFolder + alias); rs.Save(r, alias); rs.Dispose(); return(r); } return(null); }
public override string[] GetAvailableRevisions() { string url = Url.TrimEnd('/'); using (SvnClient client = new SvnClient()) { client.LoadConfiguration("path"); client.Authentication.DefaultCredentials = new NetworkCredential(Login, Password); SvnTarget folderTarget = SvnTarget.FromString(url); List <String> filesFound = new List <String>(); Collection <SvnListEventArgs> listResults; if (client.GetList(folderTarget, out listResults)) { foreach (SvnListEventArgs item in listResults) { if (item.Entry.NodeKind == SvnNodeKind.Directory && !string.IsNullOrEmpty(item.Name)) { filesFound.Add(item.Name); } } return(filesFound.ToArray()); } } return(new string[0]); }
private static string[] getItems(SvnClient client, SvnTarget folderTarget, SvnNodeKind tipoObjeto) { List <String> filesFound = new List <String>(); Collection <SvnListEventArgs> listResults; if (client.GetList(folderTarget, out listResults)) { foreach (SvnListEventArgs item in listResults) { if (item.Entry.NodeKind == tipoObjeto) { if (!String.IsNullOrEmpty(item.Path)) { filesFound.Add(item.Path); } } } return(filesFound.ToArray()); } else { throw new Exception("Failed to retrieve files via SharpSvn"); } }
public void ParseBlame(string fileName, int lineNumber) { CaseSensFileName = GetProperFilePathCapitalization(fileName); Revision = 0; Author = "unknown"; try { using (var client = new SvnClient()) { client.Authentication.DefaultCredentials = new NetworkCredential("vivabuild", "#%tsargWV45!@^@gvtRSW"); SvnTarget target = SvnPathTarget.FromString(CaseSensFileName); Collection <SvnBlameEventArgs> list; client.GetBlame(target, out list); int idx = lineNumber - 1; if (0 <= idx && idx < list.Count) { Revision = list[idx].Revision; Author = list[idx].Author; } } } catch (Exception) { ; } AddAuthor(Author); }
/// <summary> /// Build the target from a uri. /// </summary> /// <param name="path"></param> /// <returns></returns> private SvnTarget BuildTarget(Uri path) { SvnTarget target; SvnTarget.TryParse(path.OriginalString, out target); return(target); }
/// <summary> /// Initializes a new instance of the <see cref="SvnOrigin"/> class from a SvnTarget /// </summary> /// <param name="context">The context.</param> /// <param name="target">The target.</param> /// <param name="reposRoot">The repos root or <c>null</c> to retrieve the repository root from target</param> public SvnOrigin(IAnkhServiceProvider context, SvnTarget target, Uri reposRoot) { if (context == null) { throw new ArgumentNullException("context"); } else if (target == null) { throw new ArgumentNullException("target"); } SvnPathTarget pt = target as SvnPathTarget; if (pt != null) { SvnItem item = context.GetService <ISvnStatusCache>()[pt.FullPath]; if (item == null || !item.IsVersioned) { throw new InvalidOperationException("Can only create a SvnOrigin from versioned items"); } _target = target; _uri = item.Status.Uri; _reposRoot = item.WorkingCopy.RepositoryRoot; // BH: Prefer the actual root over the provided return; } SvnUriTarget ut = target as SvnUriTarget; if (ut != null) { _target = ut; _uri = ut.Uri; if (reposRoot != null) { _reposRoot = reposRoot; } else { using (SvnClient client = context.GetService <ISvnClientPool>().GetClient()) { _reposRoot = client.GetRepositoryRoot(ut.Uri); if (_reposRoot == null) { throw new InvalidOperationException("Can't retrieve the repository root of the UriTarget"); } #if DEBUG Debug.Assert(!_reposRoot.MakeRelativeUri(_uri).IsAbsoluteUri); #endif } } return; } throw new InvalidOperationException("Invalid target type"); }
private string Diff(string pSourcePath, Uri u) { if (client == null) { Init(); } try { MemoryStream objMemoryStream = new MemoryStream(); SvnDiffArgs da = new SvnDiffArgs(); da.IgnoreAncestry = true; da.DiffArguments.Add("-b"); da.DiffArguments.Add("-w"); bool b = client.Diff(SvnTarget.FromString(pSourcePath), new SvnUriTarget(u, SvnRevision.Head), da, objMemoryStream); objMemoryStream.Position = 0; StreamReader strReader = new StreamReader(objMemoryStream); string str = strReader.ReadToEnd(); return(str); } catch (Exception e) { throw e; } }
public void TestGetOnCwd() { SvnSandBox sbox = new SvnSandBox(this); Uri CollabReposUri = sbox.CreateRepository(SandBoxRepository.MergeScenario); string wc = sbox.Wc; Client.CheckOut(new Uri(CollabReposUri, "trunk"), wc); string dir = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(wc); try { string v; Assert.That(Client.TryGetProperty(".", SvnPropertyNames.SvnMergeInfo, out v)); Assert.That(v, Is.Not.Null); Assert.That(Client.TryGetProperty(SvnTarget.FromString("."), SvnPropertyNames.SvnMergeInfo, out v)); Assert.That(v, Is.Not.Null); } finally { Directory.SetCurrentDirectory(wc); } }
private bool ConexaoOK(string p_URL_SVN, string p_Usuario_SVN, string p_Senha_SVN) { bool Resp = false; SvnClient _SvnClient = new SvnClient(); SvnTarget _SvnTarget = SvnTarget.FromString(p_URL_SVN); _SvnClient.Authentication.DefaultCredentials = new NetworkCredential(p_Usuario_SVN, p_Senha_SVN); System.Collections.ObjectModel.Collection <SvnListEventArgs> _Lista; for (int i = 0; i < 5; i++) { try { if (_SvnClient.GetList(_SvnTarget, out _Lista)) { Resp = true; } } catch (Exception) { } } return(Resp); }
private void Run(Stream stream) { string tmpFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); try { using (SvnClient client = new SvnClient()) { //client.Authentication.Clear(); client.Authentication.UserNamePasswordHandlers += Authentication_UserNamePasswordHandlers; SvnUpdateResult res; bool downloaded = client.Export(SvnTarget.FromUri(SvnUri), tmpFolder, out res); if (downloaded == false) { throw new Exception("Download Failed"); } } using (ZipFile zipFile = new ZipFile()) { zipFile.AddDirectory(tmpFolder, GetFolderName()); zipFile.Save(stream); } } finally { if (File.Exists(tmpFolder)) { File.Delete(tmpFolder); } } }
internal bool CreateTag(SvnListEventArgs selectedTrunk, string tagName) { try { if (selectedTrunk != null) { using (SvnClient client = new SvnClient()) { // Bind the SharpSvn UI to our client for SSL certificate and credentials SvnUIBindArgs bindArgs = new SvnUIBindArgs(); SvnUI.Bind(client, bindArgs); string relativeComponentPath = selectedTrunk.BaseUri.AbsoluteUri; Uri tagUri = new Uri(relativeComponentPath + "tags/" + tagName); SvnTarget source = SvnTarget.FromUri(selectedTrunk.Uri); SvnCopyArgs arg = new SvnCopyArgs(); arg.CreateParents = false; arg.LogMessage = string.Format("ADMIN-0: Tag Created from Trunk"); return(client.RemoteCopy(source, tagUri, arg)); } } return(false); } catch (Exception) { throw; } }
/// <summary> /// Returns a list of the contents of the directory /// </summary> /// <param name="svnTarget"></param> /// <returns></returns> public static Collection <SvnListEventArgs> FetchListing(SvnTarget svnTarget, SvnListArgs args = null) { args = args == null ? new SvnListArgs() : args; var result = new Collection <SvnListEventArgs>(); _client.Value.GetList(svnTarget, args, out result); return(result); }
/// <summary> /// Extract a file from svn and write it locally (and overwrite what was already taken out!). /// </summary> /// <param name="ds"></param> /// <param name="outfile"></param> public static void ExtractFile(SvnTarget ds, FileInfo outfile) { var args = new SvnExportArgs() { Overwrite = true }; _client.Value.Export(ds, outfile.FullName, args); }
public TTarget GetTarget <TTarget>() where TTarget : SvnTarget { SvnTarget rslt; if (SvnTarget.TryParse(Target, out rslt)) { return(rslt as TTarget); } return(null); }
public TSource GetSource <TSource>() where TSource : SvnTarget { SvnTarget rslt; if (SvnTarget.TryParse(Source, out rslt)) { return(rslt as TSource); } return(null); }
private void folder_Expanded(object sender, RoutedEventArgs e) { TreeViewItem item = (TreeViewItem)sender; if (item.Items.Count == 1 && item.Items[0] == _dummyNode) { item.Items.Clear(); try { Collection <SvnListEventArgs> list = new Collection <SvnListEventArgs>(); string sub_dir = (string)item.Tag; SvnTarget repos = (SvnTarget)sub_dir; svn.GetList(repos, out list); if (list.Count > 1 && !TreeViewItemProps.GetFileType(item).Equals("folder")) { TreeViewItemProps.SetFileType(item, "folder"); } list.RemoveAt(0); foreach (var file in list) { TreeViewItem sub_item = new TreeViewItem(); if (file.Name.Contains(".txt")) { TreeViewItemProps.SetFileType(sub_item, "txt"); } else if (file.Name.Contains(".exe")) { TreeViewItemProps.SetFileType(sub_item, "exe"); } else { if (file.Name.Contains(".c") || file.Name.Contains(".py") || file.Name.Contains(".sh") || file.Name.Contains(".h") || file.Name.Contains(".lua") || file.Name.Contains(".js")) { TreeViewItemProps.SetFileType(sub_item, "code"); } else if (file.Name.Contains(".")) { TreeViewItemProps.SetFileType(sub_item, "unknown"); } } sub_item.Header = file.Name; sub_item.Tag = sub_dir + "/" + file.Name; sub_item.Items.Add(_dummyNode); sub_item.Expanded += folder_Expanded; item.Items.Add(sub_item); } } catch (Exception) { } } }
public void DeleteClosedFeature() { string featureRootUrl = string.Empty; Info(SvnTarget.FromString(WorkingCopyPath), (sender, args) => featureRootUrl = args.Uri.ToString()); var svnDeleteArgs = new SvnDeleteArgs { LogMessage = "Remove closed feature branch" }; RemoteDelete(new Uri(featureRootUrl), svnDeleteArgs); }
public static string GetLogText(string[] args, string revision, out Collection <SvnLogEventArgs> logItemsColl) { Parameters parameters; if (!Parameters.TryParse(args, out parameters)) { throw new Exception("TryParse failed"); } using (var client = new SharpSvn.SvnClient()) { SetUpClient(parameters, client); var target = SvnTarget.FromString(parameters.Path); SvnInfoEventArgs svnInfoEventArgs; SvnUpdateResult svnUpdateResult; if (!client.GetInfo(target, out svnInfoEventArgs)) { throw new Exception("SVN info failed"); } Uri svnUrl = svnInfoEventArgs.Uri; long revisionLong = long.Parse(revision); long revisionLongTo = svnInfoEventArgs.Revision; SvnLogArgs Logargs = new SvnLogArgs { Range = new SvnRevisionRange(revisionLong, revisionLongTo) }; Collection <SvnLogEventArgs> logItems; // client.GetLog(svnUrl, Logargs, out logItems); client.GetLog(svnUrl, out logItemsColl); string AlllogText = ""; for (int i = logItemsColl.Count - 1; i > 0; i--) { AlllogText = AlllogText + (Char)13 + (Char)10 + logItemsColl[i].Revision.ToString() + " " + logItemsColl[i].Time.ToString() + " " + logItemsColl[i].LogMessage; } return(AlllogText); throw new Exception("SVN update failed"); } return("jhgjg"); }
public override bool TestConnection(ref string error) { try { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback( delegate { return(true); } ); WebResponse response = null; bool result = false; if (SourceControlURL.ToUpper().Trim().StartsWith("HTTP")) { if (!SourceControlURL.EndsWith("/")) { SourceControlURL = SourceControlURL + "/"; } WebRequest request = WebRequest.Create(SourceControlURL); request.Timeout = 15000; request.Credentials = new System.Net.NetworkCredential(SourceControlUser, SourceControlPass); response = (WebResponse)request.GetResponse(); } else if (SourceControlURL.ToUpper().Trim().StartsWith("SVN")) { using (SvnClient sc = new SvnClient()) { sc.Authentication.DefaultCredentials = new System.Net.NetworkCredential(SourceControlUser, SourceControlPass); Uri targetUri = new Uri(SourceControlURL); var target = SvnTarget.FromUri(targetUri); Collection <SvnInfoEventArgs> info; result = sc.GetInfo(target, new SvnInfoArgs { ThrowOnError = false }, out info); } } if (response != null || result) { return(true); } else { error = "No Details"; return(false); } } catch (Exception ex) { error = ex.Message; return(false); } }
public string[] GetTempFiles(SvnTarget target, SvnRevision from, SvnRevision to, bool withProgress) { if (target == null) throw new ArgumentNullException("target"); else if (from == null) throw new ArgumentNullException("from"); else if (to == null) throw new ArgumentNullException("to"); string f1; string f2; if (from.RevisionType == SvnRevisionType.Number && to.RevisionType == SvnRevisionType.Number && from.Revision + 1 == to.Revision) { f1 = GetTempPath(target.FileName, from); f2 = GetTempPath(target.FileName, to); int n = 0; ProgressRunnerResult r = Context.GetService<IProgressRunner>().RunModal("Getting revisions", delegate(object sender, ProgressWorkerArgs e) { SvnFileVersionsArgs ea = new SvnFileVersionsArgs(); ea.Start = from; ea.End = to; e.Client.FileVersions(target, ea, delegate(object sender2, SvnFileVersionEventArgs e2) { if (n++ == 0) e2.WriteTo(f1); else e2.WriteTo(f2); }); }); if (!r.Succeeded) return null; if (n != 2) { // Sloooooow workaround for SvnBridge / Codeplex f1 = GetTempFile(target, from, withProgress); if (f1 == null) return null; // Canceled f2 = GetTempFile(target, to, withProgress); } } else { f1 = GetTempFile(target, from, withProgress); if (f1 == null) return null; // Canceled f2 = GetTempFile(target, to, withProgress); } if (string.IsNullOrEmpty(f1) || string.IsNullOrEmpty(f2)) return null; string[] files = new string[] { f1, f2 }; foreach (string f in files) { if (File.Exists(f)) File.SetAttributes(f, FileAttributes.ReadOnly); } return files; }
/// <summary> /// Given a listing, return an item. /// </summary> /// <param name="ds"></param> /// <returns></returns> private IEnumerable<string> GetSvnFileLines(SvnTarget ds) { // Next, fetch the file down. var targetTempPath = Path.GetTempFileName(); WriteVerbose($"Downloading svn file {ds.TargetName}"); MCJobSVNHelpers.ExtractFile(ds, new FileInfo(targetTempPath)); // Transfer process the lines var lines = new FileInfo(targetTempPath) .ReadLines() .SelectMany(l => ReplaceIncludeFiles(l, ExpandIncludeFiles)); return lines; }
public string GetTitle(SvnTarget target, SvnRevision revision) { if (target == null) throw new ArgumentNullException("target"); if (revision == null) throw new ArgumentNullException("revision"); return GetTitle(target.FileName, revision); }
/// <summary> /// Fetch the files, and if requested, all the include files as well. /// </summary> /// <param name="ds"></param> /// <param name="extractionPath"></param> /// <returns></returns> private IEnumerable<FileInfo> GetSvnFiles(SvnTarget ds, PathInfo extractionPath) { // Build the location of this file to write out. var outfile = new FileInfo(Path.Combine(extractionPath.Path, ds.FileName)); WriteVerbose($"Downloading svn file {ds.TargetName}"); MCJobSVNHelpers.ExtractFile(ds, outfile); yield return outfile; // Next, we need to dip into all the levels down to see if we can't // figure out if there are includes. var includeFiles = outfile .ReadLines() .SelectMany(l => ExtractIncludedFiles(l, extractionPath)); foreach (var l in includeFiles) { yield return l; } }
public override SvnRevisionRange GetMergeInfo(SvnTarget projectUrl, string branch, string parent) { var svnPath = GetSvnPath(projectUrl.ToString(), branch); return base.GetMergeInfo(svnPath, branch, parent); }
static IEnumerable<DirectoryEntry> List (SvnTarget target, bool recurse) { var list = new List<DirectoryEntry> (); var args = new SvnListArgs { Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children, }; lock (client) client.List (target, args, delegate (object o, SvnListEventArgs a) { if (string.IsNullOrEmpty (a.Path)) return; list.Add (new DirectoryEntry { CreatedRevision = ToBaseRevision (a.Entry.Revision).Rev, HasProps = a.Entry.HasProperties, IsDirectory = a.Entry.NodeKind == SvnNodeKind.Directory, LastAuthor = a.Entry.Author, Name = a.Path, Size = a.Entry.FileSize, Time = a.Entry.Time, }); }); return list; }
IEnumerable<DirectoryEntry> List (SvnTarget target, bool recurse) { List<DirectoryEntry> list = new List<DirectoryEntry> (); SvnListArgs args = new SvnListArgs (); args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children; lock (client) client.List (target, args, delegate (object o, SvnListEventArgs a) { if (string.IsNullOrEmpty (a.Path)) return; DirectoryEntry de = new DirectoryEntry (); de.CreatedRevision = ToBaseRevision (a.Entry.Revision).Rev; de.HasProps = a.Entry.HasProperties; de.IsDirectory = a.Entry.NodeKind == SvnNodeKind.Directory; de.LastAuthor = a.Entry.Author; de.Name = a.Path; de.Size = a.Entry.FileSize; de.Time = a.Entry.Time; list.Add (de); }); return list; }
private string GetMergeInfo(SvnTarget target) { string mergeInfo; _client.GetProperty(target, "svn:mergeinfo", out mergeInfo); return mergeInfo; }