/// <summary>Updates the specified paths to the specified revision</summary> /// <exception type="SvnException">Operation failed and args.ThrowOnError = true</exception> /// <exception type="ArgumentException">Parameters invalid</exception> /// <returns>true if the operation succeeded; false if it did not</returns> public unsafe bool Update(ICollection <string> paths, SvnUpdateArgs args, out SvnUpdateResult updateResult) { if (paths == null) { throw new ArgumentNullException(nameof(paths)); } if (args == null) { throw new ArgumentNullException(nameof(args)); } updateResult = null; foreach (string s in paths) { if (string.IsNullOrEmpty(s)) { throw new ArgumentException(SharpSvnStrings.ItemInListIsNull, nameof(paths)); } if (!IsNotUri(s)) { throw new ArgumentException(SharpSvnStrings.ArgumentMustBeAPathNotAUri, nameof(paths)); } } EnsureState(SvnContextState.AuthorizationInitialized); using var pool = new AprPool(_pool); using var store = new ArgsStore(this, args, pool); var aprPaths = new AprArray <string, AprCStrDirentMarshaller>(paths, pool); apr_array_header_t.__Internal *revs_ptr = null; svn_opt_revision_t uRev = args.Revision.Or(SvnRevision.Head).AllocSvnRevision(pool); svn_error_t r = svn_client.svn_client_update4( (void **)&revs_ptr, aprPaths.Handle, uRev, (svn_depth_t)args.Depth, args.KeepDepth, args.IgnoreExternals, args.AllowObstructions, args.AddsAsModifications, args.UpdateParents, CtxHandle, pool.Handle); if (args.HandleResult(this, r, paths)) { var revs = apr_array_header_t.__CreateInstance(new IntPtr(revs_ptr)); var aprRevs = new AprArray <long, AprSvnRevNumMarshaller>(revs, pool); updateResult = new SvnUpdateResult(paths, aprRevs.ToArray(), (paths.Count >= 1) ? aprRevs[0] : -1); return(true); } return(false); }
/// <summary>Recursively updates the specified paths to the latest (HEAD) revision</summary> /// <exception type="SvnException">Operation failed</exception> /// <exception type="ArgumentException">Parameters invalid</exception> public bool Update(ICollection <string> paths, out SvnUpdateResult updateResult) { if (paths == null) { throw new ArgumentNullException(nameof(paths)); } return(Update(paths, new SvnUpdateArgs(), out updateResult)); }
/// <summary>Performs a recursive checkout of <paramref name="url" /> to <paramref name="path" /></summary> /// <exception type="SvnException">Operation failed</exception> /// <exception type="ArgumentException">Parameters invalid</exception> public bool CheckOut(SvnUriTarget url, string path, out SvnUpdateResult result) { if (url == null) { throw new ArgumentNullException(nameof(url)); } if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException(nameof(path)); } return(CheckOut(url, path, new SvnCheckOutArgs(), out result)); }
/// <summary>Recursively updates the specified path to the latest (HEAD) revision</summary> /// <exception type="SvnException">Operation failed and args.ThrowOnError = true</exception> /// <exception type="ArgumentException">Parameters invalid</exception> public bool Update(string path, out SvnUpdateResult updateResult) { if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException(nameof(path)); } if (!IsNotUri(path)) { throw new ArgumentException(SharpSvnStrings.ArgumentMustBeAPathNotAUri, nameof(path)); } return(Update(NewSingleItemCollection(path), new SvnUpdateArgs(), out updateResult)); }
/// <summary>Performs a checkout of <paramref name="url" /> to <paramref name="path" /> to the specified param</summary> /// <exception type="SvnException">Operation failed and args.ThrowOnError = true</exception> /// <exception type="ArgumentException">Parameters invalid</exception> /// <returns>true if the operation succeeded; false if it did not</returns> public unsafe bool CheckOut(SvnUriTarget url, string path, SvnCheckOutArgs args, out SvnUpdateResult result) { if (url == null) { throw new ArgumentNullException(nameof(url)); } if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException(nameof(path)); } if (args == null) { throw new ArgumentNullException(nameof(args)); } if (args.Revision.RequiresWorkingCopy) { throw new ArgumentException(SharpSvnStrings.RevisionTypeMustBeHeadDateOrSpecific, nameof(args)); } if (url.Revision.RequiresWorkingCopy) { throw new ArgumentException(SharpSvnStrings.RevisionTypeMustBeHeadDateOrSpecific, nameof(url)); } EnsureState(SvnContextState.AuthorizationInitialized); using var pool = new AprPool(_pool); using var store = new ArgsStore(this, args, pool); int version = 0; svn_opt_revision_t pegRev = url.Revision.AllocSvnRevision(pool); svn_opt_revision_t coRev = args.Revision.Or(url.Revision).Or(SvnRevision.Head).AllocSvnRevision(pool); svn_error_t r = svn_client.svn_client_checkout3( ref version, pool.AllocUri(url.Uri), pool.AllocDirent(path), pegRev, coRev, (svn_depth_t)args.Depth, args.IgnoreExternals, args.AllowObstructions, CtxHandle, pool.Handle); result = SvnUpdateResult.Create(this, args, version); return(args.HandleResult(this, r, url)); }
/// <summary>Exports the specified target to the specified path</summary> /// <remarks>Subversion optimizes this call if you specify a workingcopy file instead of an url</remarks> public unsafe bool Export(SvnTarget from, string toPath, SvnExportArgs args, out SvnUpdateResult result) { if (from == null) { throw new ArgumentNullException(nameof(from)); } if (toPath == null) { throw new ArgumentNullException(nameof(toPath)); } if (args == null) { throw new ArgumentNullException(nameof(args)); } EnsureState(SvnContextState.AuthorizationInitialized); using var pool = new AprPool(_pool); using var store = new ArgsStore(this, args, pool); result = null; int resultRev = 0; svn_opt_revision_t pegRev = from.Revision.AllocSvnRevision(pool); svn_opt_revision_t rev = args.Revision.Or(from.GetSvnRevision(SvnRevision.Working, SvnRevision.Head)).AllocSvnRevision(pool); svn_error_t r = svn_client.svn_client_export5( ref resultRev, from.AllocAsString(pool), pool.AllocDirent(toPath), pegRev, rev, args.Overwrite, args.IgnoreExternals, args.IgnoreKeywords, (svn_depth_t)args.Depth, pool.AllocString(GetEolPtr(args.LineStyle)), CtxHandle, pool.Handle); if (args.HandleResult(this, r, from)) { result = SvnUpdateResult.Create(this, args, resultRev); return(true); } return(false); }
/// <summary>Recursively exports the specified target to the specified path</summary> /// <remarks>Subversion optimizes this call if you specify a workingcopy file instead of an url</remarks> public bool Export(SvnTarget from, string toPath, out SvnUpdateResult result) { if (from == null) { throw new ArgumentNullException(nameof(from)); } if (toPath == null) { throw new ArgumentNullException(nameof(toPath)); } if (!IsNotUri(toPath)) { throw new ArgumentException(SharpSvnStrings.ArgumentMustBeAPathNotAUri, nameof(toPath)); } return(Export(from, toPath, new SvnExportArgs(), out result)); }