internal SvnInfoEventArgs(string path, svn_client_info2_t info, AprPool pool) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (info == null) { throw new ArgumentNullException(nameof(info)); } if (pool == null) { throw new ArgumentNullException(nameof(pool)); } _info = info; _pool = pool; Path = path; Revision = info.rev; NodeKind = (SvnNodeKind)info.kind; LastChangeRevision = info.last_changed_rev; LastChangeTime = SvnBase.DateTimeFromAprTime(info.last_changed_date); HasLocalInfo = (info.wc_info != null); if (info.wc_info != null) { _wcSchedule = (SvnSchedule)info.wc_info.schedule; CopyFromRevision = info.wc_info.copyfrom_rev; Depth = (SvnDepth)info.wc_info.depth; ContentTime = SvnBase.DateTimeFromAprTime(info.wc_info.recorded_time); if (info.wc_info.recorded_size == -1) { WorkingCopySize = -1; } else { WorkingCopySize = info.wc_info.recorded_size; } Conflicted = info.wc_info.conflicts != null && (info.wc_info.conflicts.nelts > 0); } else { Depth = SvnDepth.Unknown; WorkingCopySize = -1; CopyFromRevision = -1; } if (info.size == -1) { RepositorySize = -1; } else { RepositorySize = info.size; } }
internal SvnDirEntry(svn_dirent_t entry) { _entry = entry ?? throw new ArgumentNullException(nameof(entry)); NodeKind = (SvnNodeKind)entry.kind; FileSize = entry.size; HasProperties = entry.has_props; Revision = entry.created_rev; Time = (entry.time != 0) ? SvnBase.DateTimeFromAprTime(entry.time) : DateTime.MinValue; }
internal SvnLockInfo(svn_lock_t @lock, bool localData) { if (@lock == null) { throw new ArgumentNullException(nameof(@lock)); } _localData = localData; _lock = @lock; IsRawNetworkComment = @lock.is_dav_comment; CreationTime = SvnBase.DateTimeFromAprTime(@lock.creation_date); ExpirationTime = SvnBase.DateTimeFromAprTime(@lock.expiration_date); }
internal SvnStatusEventArgs(sbyte *path, svn_client_status_t status, SvnClientContext client, AprPool pool) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (status == null) { throw new ArgumentNullException(nameof(status)); } if (pool == null) { throw new ArgumentNullException(nameof(pool)); } _pPath = path; _status = status; _pool = pool; _client = client; Versioned = status.versioned; Conflicted = status.conflicted; NodeKind = (SvnNodeKind)status.kind; FileLength = (status.filesize >= 0) ? status.filesize : -1; LocalNodeStatus = (SvnStatus)status.node_status; LocalTextStatus = (SvnStatus)status.text_status; LocalPropertyStatus = (SvnStatus)status.prop_status; Wedged = status.wc_is_locked; LocalCopied = status.copied; Revision = status.revision; LastChangeRevision = status.changed_rev; LastChangeTime = SvnBase.DateTimeFromAprTime(status.changed_date); Switched = status.switched; IsFileExternal = status.file_external; Depth = (SvnDepth)status.depth; RemoteNodeStatus = (SvnStatus)status.repos_node_status; RemoteTextStatus = (SvnStatus)status.repos_text_status; RemotePropertyStatus = (SvnStatus)status.repos_prop_status; RemoteUpdateRevision = status.ood_changed_rev; if (status.ood_changed_rev != -1) { RemoteUpdateCommitTime = SvnBase.DateTimeFromAprTime(status.ood_changed_date); RemoteUpdateNodeKind = (SvnNodeKind)status.ood_kind; } }
internal unsafe SvnLoggingEventArgs(svn_log_entry_t entry, AprPool pool) { if (entry == null) { throw new ArgumentNullException(nameof(entry)); } if (pool == null) { throw new ArgumentNullException(nameof(pool)); } _entry = entry; _pool = pool; sbyte *pcAuthor = null; sbyte *pcDate = null; sbyte *pcMessage = null; if (entry.revprops != null) { svn_compat.svn_compat_log_revprops_out(&pcAuthor, &pcDate, &pcMessage, entry.revprops); } if (pcDate != null) { long when = 0; // Documentation: date must be parsable by svn_time_from_cstring() svn_error_t err = pcDate != null?svn_time.svn_time_from_cstring(ref when, pcDate, pool.Handle) : null; if (err == null) { Time = SvnBase.DateTimeFromAprTime(when); } else { svn_error.svn_error_clear(err); } } else { Time = DateTime.MinValue; } Revision = entry.revision; _pcAuthor = pcAuthor; _pcMessage = pcMessage; NotInheritable = entry.non_inheritable; SubtractiveMerge = entry.subtractive_merge; }
internal static SvnRevision Load(svn_opt_revision_t revData) { if (revData == null) { throw new ArgumentNullException(nameof(revData)); } var type = (SvnRevisionType)revData.kind; switch (type) { case SvnRevisionType.None: return(None); case SvnRevisionType.Committed: return(Committed); case SvnRevisionType.Previous: return(Previous); case SvnRevisionType.Base: return(Base); case SvnRevisionType.Working: return(Working); case SvnRevisionType.Head: return(Head); case SvnRevisionType.Number: if (revData.value.number == 0) { return(Zero); } if (revData.value.number == 1) { return(One); } return(new SvnRevision(revData.value.number)); case SvnRevisionType.Time: // apr_time_t is in microseconds since 1-1-1970 UTC; filetime is in 100 nanoseconds return(new SvnRevision(SvnBase.DateTimeFromAprTime(revData.value.date))); default: throw new ArgumentException(SharpSvnStrings.InvalidSvnRevisionTypeValue, nameof(revData)); } }
internal unsafe void Ensure() { if (_ensured || _status == null) { return; } _ensured = true; svn_wc_status2_t.__Internal *status2; var error = libsvnsharp_wc_private.svn_wc__status2_from_3( (void **)&status2, svn_wc_status3_t.__CreateInstance(_status.backwards_compatibility_baton), _client.CtxHandle.wc_ctx, _status.local_abspath, _pool.Handle, _pool.Handle); if (error != null) { throw SvnException.Create(error); } var entry = svn_wc_entry_t.__CreateInstance(status2->entry); _entry = entry; _revision = entry.revision; _nodeKind = (SvnNodeKind)entry.kind; _schedule = (SvnSchedule)entry.schedule; _copied = entry.copied; _deleted = entry.deleted; _absent = entry.absent; _incomplete = entry.incomplete; _copyFromRev = entry.copyfrom_rev; _textTime = SvnBase.DateTimeFromAprTime(entry.text_time); _lastChangeRev = entry.cmt_rev; _lastChangeTime = SvnBase.DateTimeFromAprTime(entry.cmt_date); _lockTime = SvnBase.DateTimeFromAprTime(entry.lock_creation_date); _hasProperties = entry.has_props; _hasPropertyChanges = entry.has_prop_mods; _wcSize = entry.working_size; _keepLocal = entry.keep_local; _depth = (SvnDepth)entry.depth; }
internal unsafe SvnCommitResult(svn_commit_info_t commitInfo, AprPool pool) { if (commitInfo == null) { throw new ArgumentNullException(nameof(commitInfo)); } if (pool == null) { throw new ArgumentNullException(nameof(pool)); } Revision = commitInfo.revision; long when = 0; svn_error_t err = svn_time.svn_time_from_cstring(ref when, commitInfo.date, pool.Handle); // pool is not used at this time (might be for errors in future versions) if (err == null) { Time = SvnBase.DateTimeFromAprTime(when); } else { svn_error.svn_error_clear(err); Time = DateTime.MinValue; } Author = SvnBase.Utf8_PtrToString(commitInfo.author); PostCommitError = commitInfo.post_commit_err != null ? SvnBase.Utf8_PtrToString(commitInfo.post_commit_err) .Replace("\n", Environment.NewLine) .Replace("\r\r", "\r") : null; if (commitInfo.repos_root != null) { RepositoryRoot = SvnBase.Utf8_PtrToUri(commitInfo.repos_root, SvnNodeKind.Directory); } }