当前位置: 首页>>代码示例>>C#>>正文


C# Core.TfsChangesetInfo类代码示例

本文整理汇总了C#中Sep.Git.Tfs.Core.TfsChangesetInfo的典型用法代码示例。如果您正苦于以下问题:C# TfsChangesetInfo类的具体用法?C# TfsChangesetInfo怎么用?C# TfsChangesetInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TfsChangesetInfo类属于Sep.Git.Tfs.Core命名空间,在下文中一共展示了TfsChangesetInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateRemote

 public IGitTfsRemote CreateRemote(TfsChangesetInfo changeset)
 {
     IGitTfsRemote remote;
     if (changeset.Remote.IsDerived)
     {
         var remoteId = GetRemoteId(changeset);
         remote = _globals.Repository.CreateTfsRemote(new RemoteInfo
             {
                 Id = remoteId,
                 Url = changeset.Remote.TfsUrl,
                 Repository = changeset.Remote.TfsRepositoryPath,
                 RemoteOptions = _remoteOptions,
             }, string.Empty);
         remote.UpdateTfsHead(changeset.GitCommit, changeset.ChangesetId);
         _stdout.WriteLine("-> new remote '" + remote.Id + "'");
     }
     else
     {
         remote = changeset.Remote;
         if (changeset.Remote.MaxChangesetId < changeset.ChangesetId)
         {
             int oldChangeset = changeset.Remote.MaxChangesetId;
             _globals.Repository.MoveTfsRefForwardIfNeeded(changeset.Remote);
             _stdout.WriteLine("-> existing remote {0} (updated from changeset {1})", changeset.Remote.Id, oldChangeset);
         }
         else
         {
             _stdout.WriteLine("-> existing remote {0} (up to date)", changeset.Remote.Id);
         }
     }
     return remote;
 }
开发者ID:XinChenBug,项目名称:git-tfs,代码行数:32,代码来源:Bootstrapper.cs

示例2: TfsWorkspace

 public TfsWorkspace(Workspace workspace, string localDirectory, TextWriter stdout, TfsChangesetInfo contextVersion, IGitTfsRemote remote)
 {
     _workspace = workspace;
     _contextVersion = contextVersion;
     _remote = remote;
     _localDirectory = localDirectory;
     _stdout = stdout;
 }
开发者ID:ElegantCode,项目名称:git-tfs,代码行数:8,代码来源:TfsWorkspace.cs

示例3: DoCheckin

        protected override int DoCheckin(TfsChangesetInfo changeset, string refToCheckin)
        {
            if (!changeset.Remote.Tfs.CanShowCheckinDialog)
                throw new GitTfsException(
                    "checkintool does not work with this TFS version (" + changeset.Remote.Tfs.TfsClientLibraryVersion + ").",
                    new[] { "Try installing the VS2010 edition of Team Explorer." });

            return changeset.Remote.CheckinTool(refToCheckin, changeset);
        }
开发者ID:pmiossec,项目名称:git-tfs,代码行数:9,代码来源:CheckinTool.cs

示例4: DoCheckin

        protected override long DoCheckin(TfsChangesetInfo changeset, string refToCheckin)
        {
            if (!changeset.Remote.Tfs.CanPerformGatedCheckin && _checkinOptions.QueueBuildForGatedCheckIn)
                throw new GitTfsException(
                    "gated checkin does not work with this TFS version (" + changeset.Remote.Tfs.TfsClientLibraryVersion + ").",
                    new[] { "Try installing the VS2010 edition of Team Explorer." });

            return changeset.Remote.Checkin(refToCheckin, changeset);
        }
开发者ID:bretkoppel,项目名称:git-tfs,代码行数:9,代码来源:Checkin.cs

示例5: ShouldFailWithMoreThanOneParents

        public void ShouldFailWithMoreThanOneParents()
        {
            mocks.Get<Globals>().Repository = mocks.Get<IGitRepository>();
            var parentChangesets = new TfsChangesetInfo() {Remote = mocks.Get<IGitTfsRemote>()};
            mocks.Get<IGitRepository>().Stub(x => x.GetParentTfsCommits("my-head"))
                .Return(new[] {parentChangesets, parentChangesets});

            Assert.AreNotEqual(GitTfsExitCodes.OK, mocks.ClassUnderTest.MakeArgsAndRun("don't care", "my-head"));
        }
开发者ID:fschwiet,项目名称:git-tfs,代码行数:9,代码来源:ShelveTest.cs

示例6: PerformRCheckin

        private int PerformRCheckin(TfsChangesetInfo parentChangeset)
        {
            var tfsRemote = parentChangeset.Remote;
            var repo = tfsRemote.Repository;
            if (repo.WorkingCopyHasUnstagedOrUncommitedChanges)
            {
                throw new GitTfsException("error: You have local changes; rebase-workflow checkin only possible with clean working directory.")
                    .WithRecommendation("Try 'git stash' to stash your local changes and checkin again.");
            }

            // get latest changes from TFS to minimize possibility of late conflict
            _stdout.WriteLine("Fetching changes from TFS to minimize possibility of late conflict...");
            parentChangeset.Remote.Fetch();
            if (parentChangeset.ChangesetId != parentChangeset.Remote.MaxChangesetId)
            {
                throw new GitTfsException("error: New TFS changesets were found.")
                    .WithRecommendation("Try to rebase HEAD onto latest TFS checkin and repeat rcheckin or alternatively checkin s");
            }

            string tfsLatest = parentChangeset.Remote.MaxCommitHash;

            // we could rcheckin only if tfsLatest changeset is a parent of HEAD
            // so that we could rebase after each single checkin without conflicts
            if (!String.IsNullOrWhiteSpace(repo.CommandOneline("rev-list", tfsLatest, "^HEAD")))
                throw new GitTfsException("error: latest TFS commit should be parent of commits being checked in");

            while (true)
            {
                // determine first descendant of tfsLatest
                string revList = repo.CommandOneline("rev-list", "--abbrev-commit", "--parents", "--ancestry-path", "--first-parent", "--reverse", tfsLatest + "..HEAD");
                if (String.IsNullOrWhiteSpace(revList))
                {
                    _stdout.WriteLine("No more to rcheckin.");
                    return GitTfsExitCodes.OK;
                }

                string[] strs = revList.Split(' ');
                string target = strs[0];
                string[] gitParents = strs.AsEnumerable().Skip(1).Where(hash => hash != tfsLatest).ToArray();

                string commitMessage = repo.GetCommitMessage(target, tfsLatest).Trim(' ', '\r', '\n');
                _stdout.WriteLine("Starting checkin of {0} '{1}'", target, commitMessage);
                _checkinOptions.CheckinComment = commitMessage;
                long newChangesetId = tfsRemote.Checkin(target, parentChangeset);
                tfsRemote.FetchWithMerge(newChangesetId, gitParents);
                if (tfsRemote.MaxChangesetId != newChangesetId)
                    throw new GitTfsException("error: New TFS changesets were found. Rcheckin was not finished.");

                tfsLatest = tfsRemote.MaxCommitHash;
                parentChangeset = new TfsChangesetInfo {ChangesetId = newChangesetId, GitCommit = tfsLatest, Remote = tfsRemote};
                _stdout.WriteLine("Done with {0}, rebasing tail onto new TFS-commit...", target);

                repo.CommandNoisy("rebase", "--preserve-merges", "--onto", tfsLatest, target);
                _stdout.WriteLine("Rebase done successfully.");
            }
        }
开发者ID:nnieslan,项目名称:git-tfs,代码行数:56,代码来源:Rcheckin.cs

示例7: TfsWorkspace

 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;
 }
开发者ID:anonymustard,项目名称:git-tfs,代码行数:10,代码来源:TfsWorkspace.cs

示例8: GetRemoteId

        private string GetRemoteId(TfsChangesetInfo parent)
        {
            if (IsAvailable(GitTfsConstants.DefaultRepositoryId))
                return GitTfsConstants.DefaultRepositoryId;

            var hostname = new Uri(parent.Remote.TfsUrl).Host.Replace(".", "-");
            var remoteId = hostname;
            var suffix = 0;
            while (!IsAvailable(remoteId))
                remoteId = hostname + "-" + (suffix++);
            return remoteId;
        }
开发者ID:hammerdr,项目名称:git-tfs,代码行数:12,代码来源:Bootstrap.cs

示例9: GetRemoteId

        private string GetRemoteId(TfsChangesetInfo changeset)
        {
            if (IsAvailable(GitTfsConstants.DefaultRepositoryId))
            {
                _stdout.WriteLine("info: '" + changeset.Remote.TfsRepositoryPath + "' will be bootstraped as your main remote...");
                return GitTfsConstants.DefaultRepositoryId;
            }

            //Remove '$/'!
            var expectedRemoteId = changeset.Remote.TfsRepositoryPath.Substring(2).Trim('/');
            var indexOfSlash = expectedRemoteId.IndexOf('/');
            if (indexOfSlash != 0)
                expectedRemoteId = expectedRemoteId.Substring(indexOfSlash + 1);
            var remoteId = expectedRemoteId.ToGitRefName();
            var suffix = 0;
            while (!IsAvailable(remoteId))
                remoteId = expectedRemoteId + "-" + (suffix++);
            return remoteId;
        }
开发者ID:XinChenBug,项目名称:git-tfs,代码行数:19,代码来源:Bootstrapper.cs

示例10: PerformCheckin

        private int PerformCheckin(TfsChangesetInfo parentChangeset, string refToCheckin)
        {
            var newChangesetId = DoCheckin(parentChangeset, refToCheckin);

            if (_checkinOptions.NoMerge)
            {
                _stdout.WriteLine("TFS Changeset #" + newChangesetId + " was created.");
                parentChangeset.Remote.Fetch();
            }
            else
            {
                _stdout.WriteLine("TFS Changeset #" + newChangesetId + " was created. Marking it as a merge commit...");
                parentChangeset.Remote.FetchWithMerge(newChangesetId, refToCheckin);

                if (refToCheckin == "HEAD")
                    parentChangeset.Remote.Repository.CommandNoisy("merge", parentChangeset.Remote.MaxCommitHash);
            }
            return GitTfsExitCodes.OK;
        }
开发者ID:runt18,项目名称:git-tfs,代码行数:19,代码来源:CheckinBase.cs

示例11: PerformRCheckin

        private int PerformRCheckin(TfsChangesetInfo parentChangeset, string refToCheckin)
        {
            if (_globals.Repository.IsBare)
                AutoRebase = false;

            if (_globals.Repository.WorkingCopyHasUnstagedOrUncommitedChanges)
            {
                throw new GitTfsException("error: You have local changes; rebase-workflow checkin only possible with clean working directory.")
                    .WithRecommendation("Try 'git stash' to stash your local changes and checkin again.");
            }

            // get latest changes from TFS to minimize possibility of late conflict
            _stdout.WriteLine("Fetching changes from TFS to minimize possibility of late conflict...");
            parentChangeset.Remote.Fetch();
            if (parentChangeset.ChangesetId != parentChangeset.Remote.MaxChangesetId)
            {
                if (AutoRebase)
                {
                    _globals.Repository.CommandNoisy("rebase", "--preserve-merges", parentChangeset.Remote.RemoteRef);
                    parentChangeset = _globals.Repository.GetTfsCommit(parentChangeset.Remote.MaxCommitHash);
                }
                else
                {
                    if (_globals.Repository.IsBare)
                        _globals.Repository.UpdateRef(refToCheckin, parentChangeset.Remote.MaxCommitHash);

                    throw new GitTfsException("error: New TFS changesets were found.")
                        .WithRecommendation("Try to rebase HEAD onto latest TFS checkin and repeat rcheckin or alternatively checkins");
                }
            }

            IEnumerable<GitCommit> commitsToCheckin = _globals.Repository.FindParentCommits(refToCheckin, parentChangeset.Remote.MaxCommitHash);
            Trace.WriteLine("Commit to checkin count:" + commitsToCheckin.Count());
            if (!commitsToCheckin.Any())
                throw new GitTfsException("error: latest TFS commit should be parent of commits being checked in");

            SetupMetadataExport(parentChangeset.Remote);

            return _PerformRCheckinQuick(parentChangeset, refToCheckin, commitsToCheckin);
        }
开发者ID:devopsteamberlin,项目名称:git-tfs,代码行数:40,代码来源:Rcheckin.cs

示例12: PerformRCheckin

        private int PerformRCheckin(TfsChangesetInfo parentChangeset, string refToCheckin)
        {
            if (_globals.Repository.IsBare)
                AutoRebase = false;

            if (_globals.Repository.WorkingCopyHasUnstagedOrUncommitedChanges)
            {
                throw new GitTfsException("error: You have local changes; rebase-workflow checkin only possible with clean working directory.")
                    .WithRecommendation("Try 'git stash' to stash your local changes and checkin again.");
            }

            // get latest changes from TFS to minimize possibility of late conflict
            _stdout.WriteLine("Fetching changes from TFS to minimize possibility of late conflict...");
            parentChangeset.Remote.Fetch();
            if (parentChangeset.ChangesetId != parentChangeset.Remote.MaxChangesetId)
            {
                if (!Old && AutoRebase)
                {
                    _globals.Repository.CommandNoisy("rebase", "--preserve-merges", parentChangeset.Remote.RemoteRef);
                    parentChangeset = _globals.Repository.GetTfsCommit(parentChangeset.Remote.MaxCommitHash);
                }
                else
                {
                    if (_globals.Repository.IsBare)
                        _globals.Repository.UpdateRef(refToCheckin, parentChangeset.Remote.MaxCommitHash);

                    throw new GitTfsException("error: New TFS changesets were found.")
                        .WithRecommendation("Try to rebase HEAD onto latest TFS checkin and repeat rcheckin or alternatively checkin s");
                }
            }

            string tfsLatest = parentChangeset.Remote.MaxCommitHash;

            // we could rcheckin only if tfsLatest changeset is a parent of HEAD
            // so that we could rebase after each single checkin without conflicts
            if (!String.IsNullOrWhiteSpace(_globals.Repository.CommandOneline("rev-list", tfsLatest, "^" + refToCheckin)))
                throw new GitTfsException("error: latest TFS commit should be parent of commits being checked in");

            return (!Old || _globals.Repository.IsBare) ? _PerformRCheckinQuick(parentChangeset, refToCheckin) : _PerformRCheckin(parentChangeset, refToCheckin);
        }
开发者ID:Galilyou,项目名称:git-tfs,代码行数:40,代码来源:Rcheckin.cs

示例13: PerformCheckin

        private int PerformCheckin(TfsChangesetInfo parentChangeset, string refToCheckin)
        {
            var newChangesetId = DoCheckin(parentChangeset, refToCheckin);

            if (_checkinOptions.NoMerge)
            {
                _stdout.WriteLine("TFS Changeset #" + newChangesetId + " was created.");
                parentChangeset.Remote.Fetch();
            }
            else
            {
                _stdout.WriteLine("TFS Changeset #" + newChangesetId + " was created. Marking it as a merge commit...");
                parentChangeset.Remote.FetchWithMerge(newChangesetId, false, refToCheckin);

                if (refToCheckin == "HEAD")
                    parentChangeset.Remote.Repository.Merge(parentChangeset.Remote.MaxCommitHash);
            }

            Trace.WriteLine("Cleaning...");
            parentChangeset.Remote.CleanupWorkspaceDirectory();

            return GitTfsExitCodes.OK;
        }
开发者ID:XinChenBug,项目名称:git-tfs,代码行数:23,代码来源:CheckinBase.cs

示例14: Verify

        public int Verify(TfsChangesetInfo changeset, bool ignorePathCaseMismatch)
        {
            Trace.TraceInformation("Comparing TFS changeset " + changeset.ChangesetId + " to git commit " + changeset.GitCommit);
            var tfsTree = changeset.Remote.GetChangeset(changeset.ChangesetId).GetTree().ToDictionary(entry => entry.FullName.ToLowerInvariant().Replace("/", @"\"));
            var gitTree = changeset.Remote.Repository.GetCommit(changeset.GitCommit).GetTree().ToDictionary(entry => entry.Entry.Path.ToLowerInvariant());

            var all = tfsTree.Keys.Union(gitTree.Keys);
            var inBoth = tfsTree.Keys.Intersect(gitTree.Keys);
            var tfsOnly = tfsTree.Keys.Except(gitTree.Keys);
            var gitOnly = gitTree.Keys.Except(tfsTree.Keys);

            var foundDiff = GitTfsExitCodes.OK;
            foreach (var file in all.OrderBy(x => x))
            {
                if (tfsTree.ContainsKey(file))
                {
                    if (gitTree.ContainsKey(file))
                    {
                        if (Compare(tfsTree[file], gitTree[file], ignorePathCaseMismatch))
                            foundDiff = Math.Max(foundDiff, GitTfsExitCodes.VerifyContentMismatch);
                    }
                    else
                    {
                        Trace.TraceInformation("Only in TFS: " + tfsTree[file].FullName);
                        foundDiff = Math.Max(foundDiff, GitTfsExitCodes.VerifyFileMissing);
                    }
                }
                else
                {
                    Trace.TraceInformation("Only in git: " + gitTree[file].FullName);
                    foundDiff = Math.Max(foundDiff, GitTfsExitCodes.VerifyFileMissing);
                }
            }
            if (foundDiff == GitTfsExitCodes.OK)
                Trace.TraceInformation("No differences!");
            return foundDiff;
        }
开发者ID:pmiossec,项目名称:git-tfs,代码行数:37,代码来源:Verify.cs

示例15: Verify

        public void Verify(TfsChangesetInfo changeset)
        {
            _stdout.WriteLine("Comparing TFS changeset " + changeset.ChangesetId + " to git commit " + changeset.GitCommit);
            var tfsTree = changeset.Remote.GetChangeset(changeset.ChangesetId).GetTree().ToDictionary(entry => entry.FullName.ToLowerInvariant().Replace("/",@"\"));
            var gitTree = changeset.Remote.Repository.GetCommit(changeset.GitCommit).GetTree().ToDictionary(entry => entry.Entry.Path.ToLowerInvariant());

            var all = tfsTree.Keys.Union(gitTree.Keys);
            var inBoth = tfsTree.Keys.Intersect(gitTree.Keys);
            var tfsOnly = tfsTree.Keys.Except(gitTree.Keys);
            var gitOnly = gitTree.Keys.Except(tfsTree.Keys);

            var foundDiff = false;
            foreach(var file in all.OrderBy(x => x))
            {
                if(tfsTree.ContainsKey(file))
                {
                    if(gitTree.ContainsKey(file))
                    {
                        if (Compare(tfsTree[file], gitTree[file]))
                            foundDiff = true;
                    }
                    else
                    {
                        _stdout.WriteLine("Only in TFS: " + tfsTree[file].FullName);
                        foundDiff = true;
                    }
                }
                else
                {
                    _stdout.WriteLine("Only in git: " + gitTree[file].FullName);
                    foundDiff = true;
                }
            }
            if(!foundDiff)
                _stdout.WriteLine("No differences!");
        }
开发者ID:nprabhakar,项目名称:git-tfs,代码行数:36,代码来源:Verify.cs


注:本文中的Sep.Git.Tfs.Core.TfsChangesetInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。