Exemplo n.º 1
1
 public GitTfsRemote(RemoteOptions remoteOptions, Globals globals, ITfsHelper tfsHelper, TextWriter stdout)
 {
     this.remoteOptions = remoteOptions;
     this.globals = globals;
     this.stdout = stdout;
     Tfs = tfsHelper;
 }
Exemplo n.º 2
0
 public TfsChangeset(ITfsHelper tfs, IChangeset changeset, AuthorsFile authors)
 {
     _tfs = tfs;
     _changeset = changeset;
     _authors = authors;
     BaseChangesetId = _changeset.Changes.Max(c => c.Item.ChangesetId) - 1;
 }
Exemplo n.º 3
0
        public static void WriteRemoteTfsBranchStructure(ITfsHelper tfsHelper, TextWriter writer, string tfsRepositoryPath, IEnumerable<IGitTfsRemote> tfsRemotes = null)
        {
            var root = tfsHelper.GetRootTfsBranchForRemotePath(tfsRepositoryPath);

            var visitor = new WriteBranchStructureTreeVisitor(tfsRepositoryPath, writer, tfsRemotes);
            root.AcceptVisitor(visitor);
        }
Exemplo n.º 4
0
 public ListRemoteBranches(Globals globals, TextWriter stdout, ITfsHelper tfsHelper, RemoteOptions remoteOptions)
 {
     this.globals       = globals;
     this.stdout        = stdout;
     this.tfsHelper     = tfsHelper;
     this.remoteOptions = remoteOptions;
 }
Exemplo n.º 5
0
 public TfsChangeset(ITfsHelper tfs, IChangeset changeset, AuthorsFile authors)
 {
     _tfs            = tfs;
     _changeset      = changeset;
     _authors        = authors;
     BaseChangesetId = _changeset.Changes.Max(c => c.Item.ChangesetId) - 1;
 }
Exemplo n.º 6
0
        public void Initialize(IBuildServerWatcher buildServerWatcher, ISettingsSource config)
        {
            if (_buildServerWatcher != null)
                throw new InvalidOperationException("Already initialized");

            _buildServerWatcher = buildServerWatcher;

            _tfsServer = config.GetString("TfsServer", null);
            _tfsTeamCollectionName = config.GetString("TfsTeamCollectionName", null);
            _projectName = config.GetString("ProjectName", null);
            _tfsBuildDefinitionName = config.GetString("TfsBuildDefinitionName", null);

            if (!string.IsNullOrEmpty(_tfsServer)
                && !string.IsNullOrEmpty(_tfsTeamCollectionName)
                && !string.IsNullOrEmpty(_projectName))
            {
                _tfsHelper = LoadAssemblyAndConnectToServer("TfsInterop.Vs2013")
                    ?? LoadAssemblyAndConnectToServer("TfsInterop.Vs2012");

                if (_tfsHelper == null)
                {
                    Trace.WriteLine("fail to load the good interop assembly :(");
                }
            }
        }
Exemplo n.º 7
0
 public ListRemoteBranches(Globals globals, TextWriter stdout, ITfsHelper tfsHelper, RemoteOptions remoteOptions)
 {
     this.globals = globals;
     this.stdout = stdout;
     this.tfsHelper = tfsHelper;
     this.remoteOptions = remoteOptions;
 }
Exemplo n.º 8
0
 public Create(ITfsHelper tfsHelper, Clone clone, RemoteOptions remoteOptions, TextWriter stdout)
 {
     _stdout = stdout;
     _tfsHelper = tfsHelper;
     _clone = clone;
     _remoteOptions = remoteOptions;
 }
Exemplo n.º 9
0
 public TfsChangeset(ITfsHelper tfs, IChangeset changeset, TextWriter stdout, AuthorsFile authors)
 {
     _tfs = tfs;
     _changeset = changeset;
     _stdout = stdout;
     _authors = authors;
 }
Exemplo n.º 10
0
 public Create(ITfsHelper tfsHelper, Clone clone, RemoteOptions remoteOptions, TextWriter stdout)
 {
     _stdout        = stdout;
     _tfsHelper     = tfsHelper;
     _clone         = clone;
     _remoteOptions = remoteOptions;
 }
Exemplo n.º 11
0
        public void Initialize(IBuildServerWatcher buildServerWatcher, ISettingsSource config, Func <string, bool> isCommitInRevisionGrid)
        {
            if (_buildServerWatcher != null)
            {
                throw new InvalidOperationException("Already initialized");
            }

            _buildServerWatcher = buildServerWatcher;

            _tfsServer             = config.GetString("TfsServer", null);
            _tfsTeamCollectionName = config.GetString("TfsTeamCollectionName", null);
            _projectName           = config.GetString("ProjectName", null);
            var tfsBuildDefinitionNameFilterSetting = config.GetString("TfsBuildDefinitionName", "");

            if (!BuildServerSettingsHelper.IsRegexValid(tfsBuildDefinitionNameFilterSetting))
            {
                return;
            }

            _tfsBuildDefinitionNameFilter = new Regex(tfsBuildDefinitionNameFilterSetting, RegexOptions.Compiled);

            if (!string.IsNullOrEmpty(_tfsServer) &&
                !string.IsNullOrEmpty(_tfsTeamCollectionName) &&
                !string.IsNullOrEmpty(_projectName))
            {
                _tfsHelper = LoadAssemblyAndConnectToServer("TfsInterop.Vs2015")
                             ?? LoadAssemblyAndConnectToServer("TfsInterop.Vs2013")
                             ?? LoadAssemblyAndConnectToServer("TfsInterop.Vs2012");

                if (_tfsHelper == null)
                {
                    Trace.WriteLine("fail to load the good interop assembly :(");
                }
            }
        }
Exemplo n.º 12
0
        public void Initialize(IBuildServerWatcher buildServerWatcher, ISettingsSource config)
        {
            if (_buildServerWatcher != null)
            {
                throw new InvalidOperationException("Already initialized");
            }

            _buildServerWatcher = buildServerWatcher;

            _tfsServer              = config.GetString("TfsServer", null);
            _tfsTeamCollectionName  = config.GetString("TfsTeamCollectionName", null);
            _projectName            = config.GetString("ProjectName", null);
            _tfsBuildDefinitionName = config.GetString("TfsBuildDefinitionName", null);

            if (!string.IsNullOrEmpty(_tfsServer) &&
                !string.IsNullOrEmpty(_tfsTeamCollectionName) &&
                !string.IsNullOrEmpty(_projectName))
            {
                _tfsHelper = LoadAssemblyAndConnectToServer("TfsInterop.Vs2013")
                             ?? LoadAssemblyAndConnectToServer("TfsInterop.Vs2012");

                if (_tfsHelper == null)
                {
                    Trace.WriteLine("fail to load the good interop assembly :(");
                }
            }
        }
Exemplo n.º 13
0
 public TfsChangeset(ITfsHelper tfs, IChangeset changeset, TextWriter stdout, AuthorsFile authors)
 {
     _tfs       = tfs;
     _changeset = changeset;
     _stdout    = stdout;
     _authors   = authors;
 }
Exemplo n.º 14
0
        public static BranchTree GetRootTfsBranchForRemotePath(this ITfsHelper tfs, string remoteTfsPath, bool searchExactPath = true)
        {
            var branches    = tfs.GetBranches();
            var branchTrees = branches.Aggregate(new Dictionary <string, BranchTree>(StringComparer.OrdinalIgnoreCase), (dict, branch) => dict.Tap(d => d.Add(branch.Path, new BranchTree(branch))));

            foreach (var branch in branchTrees.Values)
            {
                if (!branch.IsRoot)
                {
                    //in some strange cases there might be a branch which is not marked as IsRoot
                    //but the parent for this branch is missing.
                    if (branchTrees.ContainsKey(branch.ParentPath))
                    {
                        branchTrees[branch.ParentPath].ChildBranches.Add(branch);
                    }
                }
            }
            var roots = branchTrees.Values.Where(b => b.IsRoot);

            return(roots.FirstOrDefault(b =>
            {
                var visitor = new BranchTreeContainsPathVisitor(remoteTfsPath, searchExactPath);
                b.AcceptVisitor(visitor);
                return visitor.Found;
            }));
        }
Exemplo n.º 15
0
        public static void WriteRemoteTfsBranchStructure(ITfsHelper tfsHelper, string tfsRepositoryPath, IEnumerable <IGitTfsRemote> tfsRemotes = null)
        {
            var root    = tfsHelper.GetRootTfsBranchForRemotePath(tfsRepositoryPath);
            var visitor = new WriteBranchStructureTreeVisitor(tfsRepositoryPath, tfsRemotes);

            root.AcceptVisitor(visitor);
        }
Exemplo n.º 16
0
 public GitTfsRemote(RemoteOptions remoteOptions, Globals globals, ITfsHelper tfsHelper, TextWriter stdout)
 {
     this.remoteOptions = remoteOptions;
     this.globals       = globals;
     this.stdout        = stdout;
     Tfs = tfsHelper;
 }
Exemplo n.º 17
0
 public GitTfs(ITfsHelper tfsHelper, GitTfsCommandFactory commandFactory, IHelpHelper help, IContainer container, GitTfsCommandRunner runner)
 {
     this.tfsHelper = tfsHelper;
     this.commandFactory = commandFactory;
     _help = help;
     _container = container;
     _runner = runner;
 }
Exemplo n.º 18
0
 public GitTfs(ITfsHelper tfsHelper, GitTfsCommandFactory commandFactory, IHelpHelper help, IContainer container, GitTfsCommandRunner runner)
 {
     this.tfsHelper      = tfsHelper;
     this.commandFactory = commandFactory;
     _help      = help;
     _container = container;
     _runner    = runner;
 }
Exemplo n.º 19
0
 public GlobalsTests()
 {
     _gitRepositoryMock = new Mock <IGitRepository>();
     _globals           = new Globals {
         Bootstrapper = null, Repository = _gitRepositoryMock.Object
     };
     _tfsHelper = new Mock <ITfsHelper>().Object;
 }
Exemplo n.º 20
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();
 }
Exemplo n.º 21
0
 public TfsChangeset(ITfsHelper tfs, IChangeset changeset, AuthorsFile authors, string cutPath, bool cutPathForce)
 {
     _tfs            = tfs;
     _changeset      = changeset;
     _authors        = authors;
     _cutPath        = cutPath;
     _cutPathForce   = cutPathForce;
     BaseChangesetId = _changeset.Changes.Max(c => c.Item.ChangesetId) - 1;
 }
Exemplo n.º 22
0
        public void Policy_failed_and_Force_without_an_OverrideReason()
        {
            var logger = new StringWriter();

            Trace.Listeners.Add(new TextWriterTraceListener(logger));
            IWorkspace       workspace      = MockRepository.GenerateStub <IWorkspace>();
            string           localDirectory = string.Empty;
            TfsChangesetInfo contextVersion = MockRepository.GenerateStub <TfsChangesetInfo>();
            IGitTfsRemote    remote         = MockRepository.GenerateStub <IGitTfsRemote>();

            remote.Repository = MockRepository.GenerateStub <IGitRepository>();
            CheckinOptions         checkinOptions  = new CheckinOptions();
            ITfsHelper             tfsHelper       = MockRepository.GenerateStub <ITfsHelper>();
            CheckinPolicyEvaluator policyEvaluator = new CheckinPolicyEvaluator();

            TfsWorkspace tfsWorkspace = new TfsWorkspace(workspace, localDirectory, contextVersion, remote, checkinOptions, tfsHelper, policyEvaluator);

            IPendingChange pendingChange = MockRepository.GenerateStub <IPendingChange>();

            IPendingChange[] allPendingChanges = new IPendingChange[] { pendingChange };
            workspace.Stub(w => w.GetPendingChanges()).Return(allPendingChanges);

            ICheckinEvaluationResult checkinEvaluationResult =
                new StubbedCheckinEvaluationResult()
                .WithPoilicyFailure("No work items associated.");

            checkinOptions.Force = true;

            workspace.Stub(w => w.EvaluateCheckin(
                               Arg <TfsCheckinEvaluationOptions> .Is.Anything,
                               Arg <IPendingChange[]> .Is.Anything,
                               Arg <IPendingChange[]> .Is.Anything,
                               Arg <string> .Is.Anything,
                               Arg <string> .Is.Anything,
                               Arg <ICheckinNote> .Is.Anything,
                               Arg <IEnumerable <IWorkItemCheckinInfo> > .Is.Anything))
            .Return(checkinEvaluationResult);

            workspace.Expect(w => w.Checkin(
                                 Arg <IPendingChange[]> .Is.Anything,
                                 Arg <string> .Is.Anything,
                                 Arg <string> .Is.Anything,
                                 Arg <ICheckinNote> .Is.Anything,
                                 Arg <IEnumerable <IWorkItemCheckinInfo> > .Is.Anything,
                                 Arg <TfsPolicyOverrideInfo> .Is.Anything,
                                 Arg <bool> .Is.Anything))
            .Return(0);

            var ex = Assert.Throws <GitTfsException>(() =>
            {
                var result = tfsWorkspace.Checkin(checkinOptions);
            });

            Assert.Equal("A reason must be supplied (-f REASON) to override the policy violations.", ex.Message);
            Assert.Contains("[ERROR] Policy: No work items associated.", logger.ToString());
        }
Exemplo n.º 23
0
 public GitTfs(ITfsHelper tfsHelper, GitTfsCommandFactory commandFactory, IHelpHelper help, IContainer container, IGitTfsVersionProvider gitTfsVersionProvider, GitTfsCommandRunner runner, Globals globals)
 {
     this.tfsHelper = tfsHelper;
     this.commandFactory = commandFactory;
     _help = help;
     _container = container;
     _gitTfsVersionProvider = gitTfsVersionProvider;
     _runner = runner;
     _globals = globals;
 }
Exemplo n.º 24
0
 public TfsWorkspace(IWorkspace workspace, string localDirectory, TextWriter stdout, TfsChangesetInfo contextVersion, IGitTfsRemote remote, CheckinOptions checkinOptions, ITfsHelper tfsHelper)
 {
     _workspace = workspace;
     _contextVersion = contextVersion;
     _remote = remote;
     _checkinOptions = checkinOptions;
     _tfsHelper = tfsHelper;
     _localDirectory = localDirectory;
     _stdout = stdout;
 }
Exemplo n.º 25
0
 public GitTfs(ITfsHelper tfsHelper, GitTfsCommandFactory commandFactory, IHelpHelper help, IContainer container, IGitTfsVersionProvider gitTfsVersionProvider, GitTfsCommandRunner runner, Globals globals)
 {
     this.tfsHelper      = tfsHelper;
     this.commandFactory = commandFactory;
     _help                  = help;
     _container             = container;
     _gitTfsVersionProvider = gitTfsVersionProvider;
     _runner                = runner;
     _globals               = globals;
 }
Exemplo n.º 26
0
 public TfsWorkspace(IWorkspace workspace, string localDirectory, TextWriter stdout, TfsChangesetInfo contextVersion, IGitTfsRemote remote, CheckinOptions checkinOptions, ITfsHelper tfsHelper, CheckinPolicyEvaluator policyEvaluator)
 {
     _workspace       = workspace;
     _policyEvaluator = policyEvaluator;
     _contextVersion  = contextVersion;
     _remote          = remote;
     _checkinOptions  = checkinOptions;
     _tfsHelper       = tfsHelper;
     _localDirectory  = localDirectory;
     _stdout          = stdout;
 }
Exemplo n.º 27
0
        public TfsWorkspace(IWorkspace workspace, string localDirectory, TfsChangesetInfo contextVersion, IGitTfsRemote remote, CheckinOptions checkinOptions, ITfsHelper tfsHelper, CheckinPolicyEvaluator policyEvaluator)
        {
            _workspace       = workspace;
            _policyEvaluator = policyEvaluator;
            _contextVersion  = contextVersion;
            _checkinOptions  = checkinOptions;
            _tfsHelper       = tfsHelper;
            _localDirectory  = remote.Repository.IsBare ? Path.GetFullPath(localDirectory) : localDirectory;

            Remote = remote;
        }
Exemplo n.º 28
0
        public static void WriteRemoteTfsBranchStructure(ITfsHelper tfsHelper, TextWriter writer, string tfsRepositoryPath, IEnumerable <IGitTfsRemote> tfsRemotes = null)
        {
            var root = tfsHelper.GetRootTfsBranchForRemotePath(tfsRepositoryPath);

            if (!tfsHelper.CanGetBranchInformation)
            {
                throw new GitTfsException("error: this version of TFS doesn't support this functionality");
            }
            var visitor = new WriteBranchStructureTreeVisitor(tfsRepositoryPath, writer, tfsRemotes);

            root.AcceptVisitor(visitor);
        }
Exemplo n.º 29
0
        public GitTfsRemote(RemoteOptions remoteOptions, Globals globals, ITfsHelper tfsHelper, TextWriter stdout)
        {
            this.remoteOptions = remoteOptions;
            this.globals       = globals;
            this.stdout        = stdout;
            Tfs = tfsHelper;

            if (!string.IsNullOrEmpty(globals.Username) && !string.IsNullOrEmpty(globals.Password))
            {
                Tfs.Credentials = new NetworkCredential(globals.Username, globals.Password);
            }
        }
Exemplo n.º 30
0
 public GitTfs(ITfsHelper tfsHelper, GitTfsCommandFactory commandFactory, IHelpHelper help, IContainer container,
               IGitTfsVersionProvider gitTfsVersionProvider, GitTfsCommandRunner runner, Globals globals, TextWriter stdout, Bootstrapper bootstrapper)
 {
     this.tfsHelper      = tfsHelper;
     this.commandFactory = commandFactory;
     _help                  = help;
     _container             = container;
     _gitTfsVersionProvider = gitTfsVersionProvider;
     _runner                = runner;
     _globals               = globals;
     _stdout                = stdout;
     _bootstrapper          = bootstrapper;
 }
Exemplo n.º 31
0
 public GitTfs(ITfsHelper tfsHelper, GitTfsCommandFactory commandFactory, IHelpHelper help, IContainer container,
     IGitTfsVersionProvider gitTfsVersionProvider, GitTfsCommandRunner runner, Globals globals, TextWriter stdout, Bootstrapper bootstrapper)
 {
     this.tfsHelper = tfsHelper;
     this.commandFactory = commandFactory;
     _help = help;
     _container = container;
     _gitTfsVersionProvider = gitTfsVersionProvider;
     _runner = runner;
     _globals = globals;
     _stdout = stdout;
     _bootstrapper = bootstrapper;
 }
Exemplo n.º 32
0
        public void Policy_failed_and_Force_with_an_OverrideReason()
        {
            IWorkspace       workspace      = MockRepository.GenerateStub <IWorkspace>();
            string           localDirectory = string.Empty;
            TextWriter       writer         = new StringWriter();
            TfsChangesetInfo contextVersion = MockRepository.GenerateStub <TfsChangesetInfo>();
            IGitTfsRemote    remote         = MockRepository.GenerateStub <IGitTfsRemote>();

            remote.Repository = MockRepository.GenerateStub <IGitRepository>();
            CheckinOptions         checkinOptions  = new CheckinOptions();
            ITfsHelper             tfsHelper       = MockRepository.GenerateStub <ITfsHelper>();
            CheckinPolicyEvaluator policyEvaluator = new CheckinPolicyEvaluator();

            TfsWorkspace tfsWorkspace = new TfsWorkspace(workspace, localDirectory, writer, contextVersion, remote, checkinOptions, tfsHelper, policyEvaluator);

            IPendingChange pendingChange = MockRepository.GenerateStub <IPendingChange>();

            IPendingChange[] allPendingChanges = new IPendingChange[] { pendingChange };
            workspace.Stub(w => w.GetPendingChanges()).Return(allPendingChanges);

            ICheckinEvaluationResult checkinEvaluationResult =
                new StubbedCheckinEvaluationResult()
                .WithPoilicyFailure("No work items associated.");

            checkinOptions.Force          = true;
            checkinOptions.OverrideReason = "no work items";

            workspace.Stub(w => w.EvaluateCheckin(
                               Arg <TfsCheckinEvaluationOptions> .Is.Anything,
                               Arg <IPendingChange[]> .Is.Anything,
                               Arg <IPendingChange[]> .Is.Anything,
                               Arg <string> .Is.Anything,
                               Arg <string> .Is.Anything,
                               Arg <ICheckinNote> .Is.Anything,
                               Arg <IEnumerable <IWorkItemCheckinInfo> > .Is.Anything))
            .Return(checkinEvaluationResult);

            workspace.Expect(w => w.Checkin(
                                 Arg <IPendingChange[]> .Is.Anything,
                                 Arg <string> .Is.Anything,
                                 Arg <string> .Is.Anything,
                                 Arg <ICheckinNote> .Is.Anything,
                                 Arg <IEnumerable <IWorkItemCheckinInfo> > .Is.Anything,
                                 Arg <TfsPolicyOverrideInfo> .Is.Anything,
                                 Arg <bool> .Is.Anything))
            .Return(1);

            var result = tfsWorkspace.Checkin(checkinOptions);

            Assert.Contains("[OVERRIDDEN] Policy: No work items associated.", writer.ToString());
        }
Exemplo n.º 33
0
        public void Checkin_failed()
        {
            IWorkspace       workspace      = MockRepository.GenerateStub <IWorkspace>();
            string           localDirectory = string.Empty;
            TextWriter       writer         = new StringWriter();
            TfsChangesetInfo contextVersion = MockRepository.GenerateStub <TfsChangesetInfo>();
            IGitTfsRemote    remote         = MockRepository.GenerateStub <IGitTfsRemote>();

            remote.Repository = MockRepository.GenerateStub <IGitRepository>();
            CheckinOptions         checkinOptions  = new CheckinOptions();
            ITfsHelper             tfsHelper       = MockRepository.GenerateStub <ITfsHelper>();
            CheckinPolicyEvaluator policyEvaluator = new CheckinPolicyEvaluator();

            TfsWorkspace tfsWorkspace = new TfsWorkspace(workspace, localDirectory, writer, contextVersion, remote, checkinOptions, tfsHelper, policyEvaluator);

            IPendingChange pendingChange = MockRepository.GenerateStub <IPendingChange>();

            IPendingChange[] allPendingChanges = new IPendingChange[] { pendingChange };
            workspace.Stub(w => w.GetPendingChanges()).Return(allPendingChanges);

            ICheckinEvaluationResult checkinEvaluationResult =
                new StubbedCheckinEvaluationResult();

            workspace.Stub(w => w.EvaluateCheckin(
                               Arg <TfsCheckinEvaluationOptions> .Is.Anything,
                               Arg <IPendingChange[]> .Is.Anything,
                               Arg <IPendingChange[]> .Is.Anything,
                               Arg <string> .Is.Anything,
                               Arg <string> .Is.Anything,
                               Arg <ICheckinNote> .Is.Anything,
                               Arg <IEnumerable <IWorkItemCheckinInfo> > .Is.Anything))
            .Return(checkinEvaluationResult);

            workspace.Expect(w => w.Checkin(
                                 Arg <IPendingChange[]> .Is.Anything,
                                 Arg <string> .Is.Anything,
                                 Arg <string> .Is.Anything,
                                 Arg <ICheckinNote> .Is.Anything,
                                 Arg <IEnumerable <IWorkItemCheckinInfo> > .Is.Anything,
                                 Arg <TfsPolicyOverrideInfo> .Is.Anything,
                                 Arg <bool> .Is.Anything))
            .Return(0);

            var ex = Assert.Throws <GitTfsException>(() =>
            {
                var result = tfsWorkspace.Checkin(checkinOptions);
            });

            Assert.Equal("Checkin failed!", ex.Message);
        }
Exemplo n.º 34
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;
        }
Exemplo n.º 35
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;
        }
Exemplo n.º 36
0
        public void Nothing_to_checkin()
        {
            IWorkspace             workspace       = MockRepository.GenerateStub <IWorkspace>();
            string                 localDirectory  = string.Empty;
            TextWriter             writer          = new StringWriter();
            TfsChangesetInfo       contextVersion  = MockRepository.GenerateStub <TfsChangesetInfo>();
            IGitTfsRemote          remote          = MockRepository.GenerateStub <IGitTfsRemote>();
            CheckinOptions         checkinOptions  = new CheckinOptions();
            ITfsHelper             tfsHelper       = MockRepository.GenerateStub <ITfsHelper>();
            CheckinPolicyEvaluator policyEvaluator = new CheckinPolicyEvaluator();

            TfsWorkspace tfsWorkspace = new TfsWorkspace(workspace, localDirectory, writer, contextVersion, remote, checkinOptions, tfsHelper, policyEvaluator);

            workspace.Stub(w => w.GetPendingChanges()).Return(null);

            var ex = Assert.Throws <GitTfsException>(() =>
            {
                var result = tfsWorkspace.Checkin(checkinOptions);
            });

            Assert.Equal("Nothing to checkin!", ex.Message);
        }
Exemplo n.º 37
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();
        }
Exemplo n.º 38
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();
        }
Exemplo n.º 39
0
 public TreeVerifier(ITfsHelper tfs)
 {
     _tfs = tfs;
 }
Exemplo n.º 40
0
 public Create(ITfsHelper tfsHelper, Clone clone, RemoteOptions remoteOptions)
 {
     _tfsHelper = tfsHelper;
     _clone = clone;
     _remoteOptions = remoteOptions;
 }
Exemplo n.º 41
0
 public GitTfsVersionProvider(ITfsHelper tfsHelper)
 {
     this.tfsHelper = tfsHelper;
 }
Exemplo n.º 42
0
 public GitTfsVersionProvider(ITfsHelper tfsHelper)
 {
     this.tfsHelper = tfsHelper;
 }
Exemplo n.º 43
0
 public ListRemoteBranches(ITfsHelper tfsHelper, RemoteOptions remoteOptions)
 {
     _tfsHelper = tfsHelper;
     _remoteOptions = remoteOptions;
 }
Exemplo n.º 44
0
        public static void WriteRemoteTfsBranchStructure(ITfsHelper tfsHelper, TextWriter writer, string tfsRepositoryPath, IEnumerable<IGitTfsRemote> tfsRemotes = null)
        {
            var root = tfsHelper.GetRootTfsBranchForRemotePath(tfsRepositoryPath);

            if (!tfsHelper.CanGetBranchInformation)
            {
                throw new GitTfsException("error: this version of TFS doesn't support this functionality");
            }
            var visitor = new WriteBranchStructureTreeVisitor(tfsRepositoryPath, writer, tfsRemotes);
            root.AcceptVisitor(visitor);
        }
Exemplo n.º 45
0
 public TreeVerifier(TextWriter stdout, ITfsHelper tfs)
 {
     _stdout = stdout;
     _tfs    = tfs;
 }
Exemplo n.º 46
0
 public TfsChangeset(ITfsHelper tfs, IChangeset changeset, TextWriter stdout)
 {
     _tfs = tfs;
     _changeset = changeset;
     _stdout = stdout;
 }
Exemplo n.º 47
0
 public GitTfs(ITfsHelper tfsHelper)
 {
     this.tfsHelper = tfsHelper;
 }
Exemplo n.º 48
0
 public ListRemoteBranches(ITfsHelper tfsHelper, RemoteOptions remoteOptions)
 {
     _tfsHelper     = tfsHelper;
     _remoteOptions = remoteOptions;
 }
Exemplo n.º 49
0
 /// <summary>Find the root branch that match the path given in <paramref name="remoteTfsPath" />.</summary>
 /// <param name="tfs">The <see cref="ITfsHelper" /> to use.</param>
 /// <param name="remoteTfsPath">The TFS path to search for.</param>
 /// <param name="searchExactPath">If <paramref name="remoteTfsPath" /> must match exact, or if it is ok if
 ///     <paramref name="remoteTfsPath" /> is a part of the path.</param>
 /// <returns>The root branch that match the search criteria or null if nothing was found.</returns>
 /// <remarks>
 ///     If the root branch matching the search criteria was not found, it try to search by all deleted branches to.
 ///     This can usable if the user want to clone a deleted branch.
 /// </remarks>
 public static BranchTree GetRootTfsBranchForRemotePath(this ITfsHelper tfs, string remoteTfsPath, bool searchExactPath = true)
 => GetRootTfsBranchForRemotePath(tfs, remoteTfsPath, searchExactPath, false) ??
 GetRootTfsBranchForRemotePath(tfs, remoteTfsPath, searchExactPath, true);
Exemplo n.º 50
0
 public ListRemoteBranches(Globals globals, ITfsHelper tfsHelper, RemoteOptions remoteOptions)
 {
     this.globals       = globals;
     this.tfsHelper     = tfsHelper;
     this.remoteOptions = remoteOptions;
 }
Exemplo n.º 51
0
 public TreeVerifier(TextWriter stdout, ITfsHelper tfs)
 {
     _stdout = stdout;
     _tfs = tfs;
 }
Exemplo n.º 52
0
 public TfsChangeset(ITfsHelper tfs, IChangeset changeset)
 {
     this.tfs = tfs;
     this.changeset = changeset;
 }
Exemplo n.º 53
0
 public Authors(Globals globals, ITfsHelper tfs)
 {
     globals.GcCountdown = globals.GcPeriod;
     _tfs = tfs;
 }