Beispiel #1
0
        internal static unsafe bool TryParse(string targetString, bool allowOperationalRevision, out SvnUriTarget target, AprPool pool)
        {
            if (string.IsNullOrEmpty(targetString))
            {
                throw new ArgumentNullException(nameof(targetString));
            }
            if (pool == null)
            {
                throw new ArgumentNullException(nameof(pool));
            }

            if (allowOperationalRevision)
            {
                svn_error_t r;
                sbyte *     truePath;

                var path = pool.AllocString(targetString);

                if ((r = svn_opt.svn_opt_parse_path(out svn_opt_revision_t rev, &truePath, path, pool.Handle)) == null)
                {
                    if (Uri.TryCreate(Utf8_PtrToString(truePath), UriKind.Absolute, out var uri))
                    {
                        var pegRev = SvnRevision.Load(rev);

                        target = new SvnUriTarget(uri, pegRev);
                        return(true);
                    }
                }
                else
                {
                    svn_error.svn_error_clear(r);
                }
            }
Beispiel #2
0
 /// <summary>Initializes a new <see cref="SvnLogArgs" /> instance with default properties</summary>
 public SvnLogArgs()
 {
     _start       = SvnRevision.None;
     _end         = SvnRevision.None;
     _pegRevision = SvnRevision.None;
     //_limit = 0;
     //_noLogChangedPaths = false;
     //_strictHistory = false;
 }
Beispiel #3
0
        public SvnPathTarget(string path, SvnRevision revision)
            : base(revision)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (!IsNotUri(path))
            {
                throw new ArgumentException(SharpSvnStrings.ArgumentMustBeAPathNotAUri, nameof(path));
            }

            TargetPath = GetTargetPath(path);
            FullPath   = GetFullTarget(TargetPath);
        }
Beispiel #4
0
        public SvnUriTarget(Uri uri, SvnRevision revision)
            : base(revision)
        {
            if (uri == null)
            {
                throw new ArgumentNullException(nameof(uri));
            }
            if (!uri.IsAbsoluteUri)
            {
                throw new ArgumentException(SharpSvnStrings.UriIsNotAbsolute, nameof(uri));
            }
            if (!IsValidReposUri(uri))
            {
                throw new ArgumentException(SharpSvnStrings.ArgumentMustBeAValidRepositoryUri, nameof(uri));
            }

            Uri = CanonicalizeUri(uri);
        }
Beispiel #5
0
        internal static unsafe bool TryParse(string targetName, bool allowOperationalRevisions, out SvnPathTarget target, AprPool pool)
        {
            if (string.IsNullOrEmpty(targetName))
            {
                throw new ArgumentNullException(nameof(targetName));
            }
            if (pool == null)
            {
                throw new ArgumentNullException(nameof(pool));
            }

            target = null;

            if (!IsNotUri(targetName))
            {
                return(false);
            }

            if (allowOperationalRevisions)
            {
                svn_error_t r;
                sbyte *     truePath;

                var path = pool.AllocDirent(targetName);

                if ((r = svn_opt.svn_opt_parse_path(out svn_opt_revision_t rev, &truePath, path, pool.Handle)) == null)
                {
                    var realPath = Utf8_PtrToString(truePath);

                    if (!realPath.Contains("://"))
                    {
                        var pegRev = SvnRevision.Load(rev);

                        target = new SvnPathTarget(realPath, pegRev);
                        return(true);
                    }
                }
                else
                {
                    svn_error.svn_error_clear(r);
                }
            }
Beispiel #6
0
        public SvnUriTarget(string uriString, SvnRevision revision)
            : base(revision)
        {
            if (string.IsNullOrEmpty(uriString))
            {
                throw new ArgumentNullException(nameof(uriString));
            }

            var uri = new Uri(uriString);

            if (!uri.IsAbsoluteUri)
            {
                throw new ArgumentException(SharpSvnStrings.UriIsNotAbsolute, nameof(uriString));
            }
            if (!IsValidReposUri(uri))
            {
                throw new ArgumentException(SharpSvnStrings.ArgumentMustBeAValidRepositoryUri, nameof(uriString));
            }

            Uri = CanonicalizeUri(uri);
        }
Beispiel #7
0
 public SvnCopyArgs()
 {
     _revision = SvnRevision.None;
 }
Beispiel #8
0
 public SvnRevisionRange(long start, long end)
 {
     StartRevision = new SvnRevision(start);
     EndRevision   = new SvnRevision(end);
 }
Beispiel #9
0
 public SvnRevisionRange(SvnRevision start, SvnRevision end)
 {
     StartRevision = start ?? throw new ArgumentNullException(nameof(start));
     EndRevision   = end ?? throw new ArgumentNullException(nameof(end));
 }
Beispiel #10
0
 internal SvnTarget(SvnRevision revision)
 {
     Revision = revision ?? SvnRevision.None;
 }
Beispiel #11
0
 public SvnUpdateArgs()
 {
     _depth    = SvnDepth.Unknown;
     _revision = SvnRevision.None;
 }
Beispiel #12
0
 public SvnExportArgs()
 {
     _depth    = SvnDepth.Infinity;
     _revision = SvnRevision.None;
 }
 public SvnGetPropertyArgs()
 {
     _depth    = SvnDepth.Empty;
     _revision = SvnRevision.None;
 }
Beispiel #14
0
 public SvnInfoArgs()
 {
     _revision = SvnRevision.None;
     _depth    = SvnDepth.Empty;
 }
Beispiel #15
0
 public SvnWriteArgs()
 {
     _revision = SvnRevision.None;
 }
Beispiel #16
0
 public SvnStatusArgs()
 {
     _depth    = SvnDepth.Infinity;
     _revision = SvnRevision.None;
 }
Beispiel #17
0
 public SvnCheckOutArgs()
 {
     _depth    = SvnDepth.Unknown;
     _revision = SvnRevision.None;
 }
Beispiel #18
0
        unsafe bool InternalLog(ICollection <string> targets, Uri searchRoot, SvnRevision altPegRev, SvnLogArgs args, EventHandler <SvnLogEventArgs> logHandler)
        {
            if (targets == null)
            {
                throw new ArgumentNullException(nameof(targets));
            }
            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);

            args._mergeLogLevel = 0; // Clear log level
            args._searchRoot    = searchRoot;

            if (logHandler != null)
            {
                args.Log += logHandler;
            }

            try
            {
                apr_array_header_t retrieveProperties;

                if (args.RetrieveAllProperties)
                {
                    retrieveProperties = null;
                }
                else if (args.RetrievePropertiesUsed)
                {
                    retrieveProperties = AllocArray(args.RetrieveProperties, pool);
                }
                else
                {
                    retrieveProperties = svn_compat.svn_compat_log_revprops_in(pool.Handle);
                }

                svn_opt_revision_t pegRev = args.OriginRevision.Or(altPegRev).AllocSvnRevision(pool);

                int count          = args.RangesUsed ? args.Ranges.Count : 1;
                var revisionRanges = apr_tables.apr_array_make(
                    pool.Handle, count, sizeof(svn_opt_revision_range_t.__Internal *));

                if (args.RangesUsed)
                {
                    foreach (SvnRevisionRange r in args.Ranges)
                    {
                        var range = (svn_opt_revision_range_t.__Internal *)pool.Alloc(
                            sizeof(svn_opt_revision_range_t.__Internal));

                        range->start = r.StartRevision.Or(SvnRevision.Head).ToSvnRevision();
                        range->end   = r.EndRevision.Or(SvnRevision.Zero).ToSvnRevision();

                        *((svn_opt_revision_range_t.__Internal * *)apr_tables.apr_array_push(revisionRanges)) = range;
                    }
                }
                else
                {
                    var range = (svn_opt_revision_range_t.__Internal *)pool.Alloc(
                        sizeof(svn_opt_revision_range_t.__Internal));

                    range->start = args.Start.Or(args.OriginRevision).Or(SvnRevision.Head).ToSvnRevision();
                    range->end   = args.End.Or(SvnRevision.Zero).ToSvnRevision();

                    *((svn_opt_revision_range_t.__Internal * *)apr_tables.apr_array_push(revisionRanges)) = range;
                }

                using var svnclient_log_receiver_handle = new SafeFuncHandle <svn_log_entry_receiver_t>(svnclient_log_handler);

                svn_error_t err = svn_client.svn_client_log5(
                    AllocArray(targets, pool),
                    pegRev,
                    revisionRanges,
                    args.Limit,
                    args.RetrieveChangedPaths,
                    args.StrictNodeHistory,
                    args.RetrieveMergedRevisions,
                    retrieveProperties,
                    svnclient_log_receiver_handle.Get(),
                    _clientBaton.Handle,
                    CtxHandle,
                    pool.Handle);

                return(args.HandleResult(this, err, targets));
            }
            finally
            {
                if (logHandler != null)
                {
                    args.Log -= logHandler;
                }

                args._searchRoot    = null;
                args._mergeLogLevel = 0;
            }
        }
Beispiel #19
0
 internal abstract SvnRevision GetSvnRevision(SvnRevision fileNoneValue, SvnRevision uriNoneValue);
Beispiel #20
0
 /// <summary>Initializes a new <see cref="SvnLogArgs" /> instance with the specified range</summary>
 public SvnLogArgs(SvnRevisionRange range)
 {
     Range        = range ?? throw new ArgumentNullException(nameof(range));
     _pegRevision = SvnRevision.None;
 }
Beispiel #21
0
 public SvnListArgs()
 {
     _depth          = SvnDepth.Children;
     _revision       = SvnRevision.None;
     RetrieveEntries = SvnDirEntryItems.SvnListDefault;
 }