public static string GetTargetPath(string path) { if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException(nameof(path)); } if (!IsNotUri(path)) { throw new ArgumentException(SharpSvnStrings.ArgumentMustBeAPathNotAUri, nameof(path)); } if (SvnTools.IsAbsolutePath(path)) { return(SvnTools.GetNormalizedFullPath(path)); } path = path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); var dualSeparator = string.Concat(Path.DirectorySeparatorChar, Path.DirectorySeparatorChar); int nNext; // Remove double backslash except at the start while ((nNext = path.IndexOf(dualSeparator, 1, StringComparison.Ordinal)) >= 0) { path = path.Remove(nNext, 1); } // Remove '\.\' while ((nNext = path.IndexOf("\\.\\", StringComparison.Ordinal)) >= 0) { path = path.Remove(nNext, 2); } while (path.StartsWith(".\\", StringComparison.Ordinal)) { path = path.Substring(2); } if (path.EndsWith("\\.", StringComparison.Ordinal)) { path = path.Substring(0, path.Length - 2); } path = path.TrimEnd(Path.DirectorySeparatorChar); if (path.Length == 0) { path = "."; } if (path.Length > 2 && path[1] == ':' && path[0] >= 'a' && path[0] <= 'z') { path = char.ToUpperInvariant(path[0]) + path.Substring(1); } return(path); }
unsafe bool InternalSetProperty(string target, string propertyName, svn_string_t value, SvnSetPropertyArgs args, AprPool pool) { if (target == null) { throw new ArgumentNullException(nameof(target)); } if (string.IsNullOrEmpty(propertyName)) { throw new ArgumentNullException(nameof(propertyName)); } if (string.IsNullOrEmpty(propertyName)) { throw new ArgumentNullException(nameof(propertyName)); } EnsureState(SvnContextState.ConfigLoaded); // We might need repository access using var store = new ArgsStore(this, args, pool); sbyte *pcPropertyName = pool.AllocString(propertyName); if (!svn_props.svn_prop_name_is_valid(pcPropertyName)) { throw new ArgumentException(SharpSvnStrings.PropertyNameIsNotValid, nameof(propertyName)); } svn_error_t r = svn_client.svn_client_propset_local( pcPropertyName, value, AllocDirentArray(NewSingleItemCollection(SvnTools.GetNormalizedFullPath(target)), pool), (svn_depth_t)args.Depth, args.SkipChecks, CreateChangeListsList(args.ChangeLists, pool), // Intersect ChangeLists CtxHandle, pool.Handle); return(args.HandleResult(this, r, target)); }
static string GetFullTarget(string path) { return(SvnTools.GetNormalizedFullPath(path)); }