Ejemplo n.º 1
1
 public GitTfsRemote(RemoteOptions remoteOptions, Globals globals, ITfsHelper tfsHelper, TextWriter stdout)
 {
     this.remoteOptions = remoteOptions;
     this.globals = globals;
     this.stdout = stdout;
     Tfs = tfsHelper;
 }
Ejemplo n.º 2
0
 public Bootstrap(RemoteOptions remoteOptions, Globals globals, TextWriter stdout, Bootstrapper bootstrapper)
 {
     _remoteOptions = remoteOptions;
     _globals = globals;
     _stdout = stdout;
     _bootstrapper = bootstrapper;
 }
Ejemplo n.º 3
0
 public Subtree(Fetch fetch, QuickFetch quickFetch, Globals globals, RemoteOptions remoteOptions)
 {
     _fetch = fetch;
     _quickFetch = quickFetch;
     _globals = globals;
     _remoteOptions = remoteOptions;
 }
Ejemplo n.º 4
0
 public Fetch(Globals globals, RemoteOptions remoteOptions, AuthorsFile authors, Labels labels)
 {
     this.remoteOptions = remoteOptions;
     this.globals = globals;
     this.authors = authors;
     this.labels = labels;
 }
Ejemplo n.º 5
0
 public Create(ITfsHelper tfsHelper, Clone clone, RemoteOptions remoteOptions, TextWriter stdout)
 {
     _stdout = stdout;
     _tfsHelper = tfsHelper;
     _clone = clone;
     _remoteOptions = remoteOptions;
 }
Ejemplo n.º 6
0
 public ListRemoteBranches(Globals globals, TextWriter stdout, ITfsHelper tfsHelper, RemoteOptions remoteOptions)
 {
     this.globals = globals;
     this.stdout = stdout;
     this.tfsHelper = tfsHelper;
     this.remoteOptions = remoteOptions;
 }
Ejemplo n.º 7
0
 public GitTfsRemote(RemoteOptions remoteOptions, Globals globals, ITfsHelper tfsHelper, TextWriter stdout)
 {
     this.remoteOptions = remoteOptions;
     this.globals = globals;
     this.stdout = stdout;
     Tfs = tfsHelper;
     _failTracker = new TfsFailTracker();
 }
Ejemplo n.º 8
0
 public Init(RemoteOptions remoteOptions, InitOptions initOptions, Globals globals, TextWriter output, IGitHelpers gitHelper)
 {
     this.remoteOptions = remoteOptions;
     this.gitHelper = gitHelper;
     this.output = output;
     this.globals = globals;
     this.initOptions = initOptions;
 }
Ejemplo n.º 9
0
 public Fetch(Globals globals, TextWriter stdout, RemoteOptions remoteOptions, AuthorsFile authors, Labels labels)
 {
     this.globals = globals;
     this.stdout = stdout;
     this.remoteOptions = remoteOptions;
     this.authors = authors;
     this.labels = labels;
 }
Ejemplo n.º 10
0
 public Subtree(TextWriter stdout, Fetch fetch, QuickFetch quickFetch, Globals globals, RemoteOptions remoteOptions)
 {
     this._stdout = stdout;
     this._fetch = fetch;
     this._quickFetch = quickFetch;
     this._globals = globals;
     this._remoteOptions = remoteOptions;
 }
Ejemplo n.º 11
0
 public Fetch(Globals globals, ConfigProperties properties, RemoteOptions remoteOptions, Labels labels)
 {
     _globals = globals;
     _properties = properties;
     _remoteOptions = remoteOptions;
     _labels = labels;
     upToChangeSet = -1;
     BranchStrategy = BranchStrategy = BranchStrategy.Auto;
 }
Ejemplo n.º 12
0
 public Fetch(Globals globals, ConfigProperties properties, TextWriter stdout, RemoteOptions remoteOptions, AuthorsFile authors, Labels labels)
 {
     this.globals = globals;
     this.properties = properties;
     this.stdout = stdout;
     this.remoteOptions = remoteOptions;
     this.authors = authors;
     this.labels = labels;
     this.upToChangeSet = -1;
 }
Ejemplo n.º 13
0
        public GitTfsRemote(RemoteInfo info, IGitRepository repository, RemoteOptions remoteOptions, Globals globals, ITfsHelper tfsHelper, TextWriter stdout)
        {
            this.remoteOptions = remoteOptions;
            this.globals = globals;
            this.stdout = stdout;
            Tfs = tfsHelper;
            Repository = repository;

            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;
            Autotag = info.Autotag;
        }
Ejemplo n.º 14
0
        public void CreateTfsRemote(string remoteId, string tfsUrl, string tfsRepositoryPath, RemoteOptions remoteOptions)
        {
            if (HasRemote(remoteId))
                throw new GitTfsException("A remote with id \"" + remoteId + "\" already exists.");

            SetTfsConfig(remoteId, "url", tfsUrl);
            SetTfsConfig(remoteId, "repository", tfsRepositoryPath);
            SetTfsConfig(remoteId, "fetch", "refs/remotes/" + remoteId + "/master");
            if (remoteOptions != null)
            {
                if (remoteOptions.NoMetaData) SetTfsConfig(remoteId, "no-meta-data", 1);
                if (remoteOptions.IgnoreRegex != null) SetTfsConfig(remoteId, "ignore-paths", remoteOptions.IgnoreRegex);
            }

            Directory.CreateDirectory(Path.Combine(this.GitDir, "tfs"));
            _cachedRemotes = null;
        }
Ejemplo n.º 15
0
        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();
        }
Ejemplo n.º 16
0
 public QuickFetch(Globals globals, TextWriter stdout, RemoteOptions remoteOptions, AuthorsFile authors)
     : base(globals, stdout, remoteOptions, authors, null)
 {
 }
Ejemplo n.º 17
0
 public ListRemoteBranches(ITfsHelper tfsHelper, RemoteOptions remoteOptions)
 {
     _tfsHelper = tfsHelper;
     _remoteOptions = remoteOptions;
 }
Ejemplo n.º 18
0
        private IGitTfsRemote InitTfsBranch(RemoteOptions remoteOptions, string tfsRepositoryPath, int rootChangesetId = -1, bool fetchParentBranch = false, string gitBranchNameExpected = null, IRenameResult renameResult = null)
        {
            Trace.WriteLine("Begin process of creating branch for remote :" + tfsRepositoryPath);
            // TFS string representations of repository paths do not end in trailing slashes
            tfsRepositoryPath = (tfsRepositoryPath ?? string.Empty).TrimEnd('/');

            string gitBranchName = ExtractGitBranchNameFromTfsRepositoryPath(
                string.IsNullOrWhiteSpace(gitBranchNameExpected) ? tfsRepositoryPath : gitBranchNameExpected);
            if (string.IsNullOrWhiteSpace(gitBranchName))
                throw new GitTfsException("error: The Git branch name '" + gitBranchName + "' is not valid...\n");
            Trace.WriteLine("Git local branch will be :" + gitBranchName);

            string sha1RootCommit = null;
            if (rootChangesetId != -1)
            {
                sha1RootCommit = Repository.FindCommitHashByChangesetId(rootChangesetId);
                if (fetchParentBranch && string.IsNullOrWhiteSpace(sha1RootCommit))
                    sha1RootCommit = FindRootRemoteAndFetch(rootChangesetId, renameResult);
                if (string.IsNullOrWhiteSpace(sha1RootCommit))
                    return null;

                Trace.WriteLine("Found commit " + sha1RootCommit + " for changeset :" + rootChangesetId);
            }

            IGitTfsRemote tfsRemote;
            if (Repository.HasRemote(gitBranchName))
            {
                Trace.WriteLine("Remote already exist");
                tfsRemote = Repository.ReadTfsRemote(gitBranchName);
                if (tfsRemote.TfsUrl != TfsUrl)
                    Trace.WriteLine("warning: Url is different");
                if (tfsRemote.TfsRepositoryPath != tfsRepositoryPath)
                    Trace.WriteLine("warning: TFS repository path is different");
            }
            else
            {
                Trace.WriteLine("Try creating remote...");
                tfsRemote = Repository.CreateTfsRemote(new RemoteInfo
                {
                    Id = gitBranchName,
                    Url = TfsUrl,
                    Repository = tfsRepositoryPath,
                    RemoteOptions = remoteOptions
                }, string.Empty);
            }
            if (sha1RootCommit != null && !Repository.HasRef(tfsRemote.RemoteRef))
            {
                if (!Repository.CreateBranch(tfsRemote.RemoteRef, sha1RootCommit))
                    throw new GitTfsException("error: Fail to create remote branch ref file!");
            }
            Trace.WriteLine("Remote created!");
            return tfsRemote;
        }
Ejemplo n.º 19
0
 public ListRemoteBranches(ITfsHelper tfsHelper, RemoteOptions remoteOptions)
 {
     _tfsHelper     = tfsHelper;
     _remoteOptions = remoteOptions;
 }
Ejemplo n.º 20
0
 public QuickFetch(Globals globals, RemoteOptions remoteOptions, AuthorsFile authors) : base(globals, remoteOptions, authors, null)
 {
 }
Ejemplo n.º 21
0
 public IGitTfsRemote InitBranch(RemoteOptions remoteOptions, string tfsRepositoryPath, int shaRootChangesetId, bool fetchParentBranch, string gitBranchNameExpected = null, IRenameResult renameResult = null)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 22
0
 public Bootstrap(RemoteOptions remoteOptions, Globals globals, TextWriter stdout)
 {
     _remoteOptions = remoteOptions;
     _globals = globals;
     _stdout = stdout;
 }
Ejemplo n.º 23
0
 public Bootstrap(RemoteOptions remoteOptions, Globals globals, Bootstrapper bootstrapper)
 {
     _remoteOptions = remoteOptions;
     _globals       = globals;
     _bootstrapper  = bootstrapper;
 }
Ejemplo n.º 24
0
 public Init(RemoteOptions remoteOptions, InitOptions initOptions, Globals globals, IGitHelpers gitHelper)
 {
     _remoteOptions = remoteOptions;
     _gitHelper = gitHelper;
     _globals = globals;
     _initOptions = initOptions;
 }
Ejemplo n.º 25
0
 public ListRemoteBranches(Globals globals, TextWriter stdout, ITfsHelper tfsHelper, RemoteOptions remoteOptions)
 {
     this.globals       = globals;
     this.stdout        = stdout;
     this.tfsHelper     = tfsHelper;
     this.remoteOptions = remoteOptions;
 }
Ejemplo n.º 26
0
 public Bootstrapper(Globals globals, RemoteOptions remoteOptions)
 {
     _globals = globals;
     _remoteOptions = remoteOptions;
 }
Ejemplo n.º 27
0
 public QuickFetch(Globals globals, TextWriter stdout, RemoteOptions remoteOptions, AuthorsFile authors)
     : base(globals, stdout, remoteOptions, authors, null)
 {
 }
Ejemplo n.º 28
0
 public Fetch(Globals globals, ConfigProperties properties, TextWriter stdout, RemoteOptions remoteOptions, AuthorsFile authors, Labels labels)
 {
     this.globals       = globals;
     this.properties    = properties;
     this.stdout        = stdout;
     this.remoteOptions = remoteOptions;
     this.authors       = authors;
     this.labels        = labels;
 }
Ejemplo n.º 29
0
 public QuickFetch(Globals globals, ConfigProperties properties, RemoteOptions remoteOptions, AuthorsFile authors)
     : base(globals, properties, remoteOptions, authors, null)
 {
     _properties = properties;
 }
Ejemplo n.º 30
0
 public Subtree(TextWriter stdout, Fetch fetch, QuickFetch quickFetch, Globals globals, RemoteOptions remoteOptions)
 {
     this._stdout        = stdout;
     this._fetch         = fetch;
     this._quickFetch    = quickFetch;
     this._globals       = globals;
     this._remoteOptions = remoteOptions;
 }
Ejemplo n.º 31
0
 public void CreateTfsRemote(string remoteId, TfsChangesetInfo tfsHead, RemoteOptions remoteOptions)
 {
     CreateTfsRemote(remoteId, tfsHead.Remote.TfsUrl, tfsHead.Remote.TfsRepositoryPath, remoteOptions);
     ReadTfsRemote(remoteId).UpdateRef(tfsHead.GitCommit, tfsHead.ChangesetId);
 }
Ejemplo n.º 32
0
        private IGitTfsRemote InitFromDefaultRemote()
        {
            IGitTfsRemote defaultRemote;
            if (_globals.Repository.HasRemote(GitTfsConstants.DefaultRepositoryId))
                defaultRemote = _globals.Repository.ReadTfsRemote(GitTfsConstants.DefaultRepositoryId);
            else
                defaultRemote = _globals.Repository.ReadAllTfsRemotes()
                    .Where(x => x != null && x.RemoteInfo != null && !string.IsNullOrEmpty(x.RemoteInfo.Url))
                    .OrderBy(x => x.RemoteInfo.Url.Length).FirstOrDefault();
            if (defaultRemote == null)
                throw new GitTfsException("error: No git-tfs repository found. Please try to clone first...\n");

            _remoteOptions = new RemoteOptions();
            if (!string.IsNullOrWhiteSpace(TfsUsername))
            {
                _remoteOptions.Username = TfsUsername;
                _remoteOptions.Password = TfsPassword;
            }
            else
            {
                _remoteOptions.Username = defaultRemote.TfsUsername;
                _remoteOptions.Password = defaultRemote.TfsPassword;
            }

            if (IgnoreRegex != null)
                _remoteOptions.IgnoreRegex = IgnoreRegex;
            else
                _remoteOptions.IgnoreRegex = defaultRemote.IgnoreRegexExpression;

            if (ExceptRegex != null)
                _remoteOptions.ExceptRegex = ExceptRegex;
            else
                _remoteOptions.ExceptRegex = defaultRemote.IgnoreExceptRegexExpression;

            return defaultRemote;
        }
Ejemplo n.º 33
0
 public Bootstrap(RemoteOptions remoteOptions, Globals globals, TextWriter stdout)
 {
     _remoteOptions = remoteOptions;
     _globals       = globals;
     _stdout        = stdout;
 }
Ejemplo n.º 34
0
 public Fetch(Globals globals, RemoteOptions remoteOptions, FcOptions fcOptions)
 {
     this.fcOptions     = fcOptions;
     this.remoteOptions = remoteOptions;
     this.globals       = globals;
 }
Ejemplo n.º 35
0
 public QuickFetch(Globals globals, RemoteOptions remoteOptions, AuthorsFile authors) : base(globals, remoteOptions, authors, null)
 {
 }
Ejemplo n.º 36
0
 public Bootstrapper(Globals globals, TextWriter stdout, RemoteOptions remoteOptions)
 {
     _globals = globals;
     _stdout = stdout;
     _remoteOptions = remoteOptions;
 }
Ejemplo n.º 37
0
 public Create(ITfsHelper tfsHelper, Clone clone, RemoteOptions remoteOptions)
 {
     _tfsHelper     = tfsHelper;
     _clone         = clone;
     _remoteOptions = remoteOptions;
 }
Ejemplo n.º 38
0
 public Fetch(Globals globals, RemoteOptions remoteOptions, FcOptions fcOptions)
 {
     this.fcOptions = fcOptions;
     this.remoteOptions = remoteOptions;
     this.globals = globals;
 }
Ejemplo n.º 39
0
 public IGitTfsRemote InitBranch(RemoteOptions remoteOptions, string tfsRepositoryPath, int rootChangesetId, bool fetchParentBranch, string gitBranchNameExpected = null, IRenameResult renameResult = null)
 {
     return InitTfsBranch(remoteOptions, tfsRepositoryPath, rootChangesetId, fetchParentBranch, gitBranchNameExpected, renameResult);
 }
Ejemplo n.º 40
0
 public QuickFetch(Globals globals, RemoteOptions remoteOptions, FcOptions fcOptions) : base(globals, remoteOptions, fcOptions)
 {
 }
Ejemplo n.º 41
0
 public ListRemoteBranches(Globals globals, ITfsHelper tfsHelper, RemoteOptions remoteOptions)
 {
     this.globals       = globals;
     this.tfsHelper     = tfsHelper;
     this.remoteOptions = remoteOptions;
 }
Ejemplo n.º 42
0
 public Bootstrap(RemoteOptions remoteOptions, Globals globals, Bootstrapper bootstrapper)
 {
     _remoteOptions = remoteOptions;
     _globals = globals;
     _bootstrapper = bootstrapper;
 }
Ejemplo n.º 43
0
        private IGitTfsRemote InitFromDefaultRemote()
        {
            var defaultRemote = _globals.Repository.ReadTfsRemote(GitTfsConstants.DefaultRepositoryId);
            if (defaultRemote == null)
                throw new GitTfsException("error: No git-tfs repository found. Please try to clone first...\n");

            _remoteOptions = new RemoteOptions();
            if (!string.IsNullOrWhiteSpace(TfsUsername))
            {
                _remoteOptions.Username = TfsUsername;
                _remoteOptions.Password = TfsPassword;
            }
            else
            {
                _remoteOptions.Username = defaultRemote.TfsUsername;
                _remoteOptions.Password = defaultRemote.TfsPassword;
            }

            if (IgnoreRegex != null)
                _remoteOptions.IgnoreRegex = IgnoreRegex;
            else
                _remoteOptions.IgnoreRegex = defaultRemote.IgnoreRegexExpression;

            if (ExceptRegex != null)
                _remoteOptions.ExceptRegex = ExceptRegex;
            else
                _remoteOptions.ExceptRegex = defaultRemote.IgnoreExceptRegexExpression;

            _authors.Parse(AuthorsFilePath, _globals.GitDir);

            return defaultRemote;
        }
Ejemplo n.º 44
0
 public Fetch(Globals globals, ConfigProperties properties, TextWriter stdout, RemoteOptions remoteOptions, AuthorsFile authors, Labels labels)
 {
     this.globals       = globals;
     this.properties    = properties;
     this.stdout        = stdout;
     this.remoteOptions = remoteOptions;
     this.authors       = authors;
     this.labels        = labels;
     this.upToChangeSet = -1;
     BranchStrategy     = BranchStrategy = BranchStrategy.Auto;
 }