public IEnumerable <KeyValuePair <string, string> > Dump(RemoteInfo remote) { if (!string.IsNullOrWhiteSpace(remote.Id)) { var prefix = "tfs-remote." + remote.Id + "."; yield return(c(prefix + "url", remote.Url)); yield return(c(prefix + "repository", remote.Repository)); yield return(c(prefix + "username", remote.Username)); yield return(c(prefix + "password", remote.Password)); yield return(c(prefix + "ignore-paths", remote.IgnoreRegex)); yield return(c(prefix + "ignore-except", remote.IgnoreExceptRegex)); yield return(c(prefix + "gitignore-path", remote.GitIgnorePath)); yield return(c(prefix + "legacy-urls", remote.Aliases == null ? null : string.Join(",", remote.Aliases))); yield return(c(prefix + "autotag", remote.Autotag ? "true" : null)); yield return(c(prefix + "noparallel", remote.NoParallel ? "true" : null)); } }
public IGitTfsRemote CreateTfsRemote(RemoteInfo remote) { foreach (var entry in _remoteConfigReader.Dump(remote)) { if (entry.Value != null) { _repository.Config.Set(entry.Key, entry.Value); } else { _repository.Config.Unset(entry.Key); } } var gitTfsRemote = BuildRemote(remote); gitTfsRemote.EnsureTfsAuthenticated(); return(_cachedRemotes[remote.Id] = gitTfsRemote); }
public IGitTfsRemote CreateTfsRemote(RemoteInfo remote, string autocrlf = null, string ignorecase = null) { if (HasRemote(remote.Id)) { throw new GitTfsException("A remote with id \"" + remote.Id + "\" already exists."); } // The autocrlf default (as indicated by a null) is false and is set to override the system-wide setting. // When creating branches we use the empty string to indicate that we do not want to set the value at all. if (autocrlf == null) { autocrlf = "false"; } if (autocrlf != string.Empty) { _repository.Config.Set("core.autocrlf", autocrlf); } if (ignorecase != null) { _repository.Config.Set("core.ignorecase", ignorecase); } foreach (var entry in _remoteConfigReader.Dump(remote)) { if (entry.Value != null) { _repository.Config.Set(entry.Key, entry.Value); } else { _repository.Config.Unset(entry.Key); } } var gitTfsRemote = BuildRemote(remote); gitTfsRemote.EnsureTfsAuthenticated(); return(_cachedRemotes[remote.Id] = gitTfsRemote); }
public GitTfsRemote(RemoteInfo info, IGitRepository repository, RemoteOptions remoteOptions, Globals globals, ITfsHelper tfsHelper, ConfigProperties properties) { _remoteOptions = remoteOptions; _globals = globals; _properties = properties; Tfs = tfsHelper; Repository = repository; RemoteInfo = info; Id = info.Id; TfsUrl = info.Url; TfsRepositoryPath = info.Repository; TfsUsername = info.Username; TfsPassword = info.Password; Aliases = (info.Aliases ?? Enumerable.Empty <string>()).ToArray(); IgnoreRegexExpression = info.IgnoreRegex; IgnoreExceptRegexExpression = info.IgnoreExceptRegex; Autotag = info.Autotag; IsSubtree = CheckSubtree(); }
private IGitTfsRemote BuildRemote(RemoteInfo remoteInfo) { return(_container.With(remoteInfo).With <IGitRepository>(this).GetInstance <IGitTfsRemote>()); }