コード例 #1
0
        public CheckinOptions BuildCommitSpecificCheckinOptions(CheckinOptions sourceCheckinOptions,
            string commitMessage, GitCommit commit, AuthorsFile authors)
        {
            var customCheckinOptions = BuildCommitSpecificCheckinOptions(sourceCheckinOptions, commitMessage);

            customCheckinOptions.ProcessAuthor(writer, commit, authors);

            return customCheckinOptions;
        }
コード例 #2
0
        public static void ProcessAuthor(this CheckinOptions checkinOptions, GitCommit commit, AuthorsFile authors)
        {
            if (!authors.IsParseSuccessfull)
                return;

            Author a = authors.FindAuthor(commit.AuthorAndEmail);
            if (a == null)
            {
                checkinOptions.AuthorTfsUserId = null;
                return;
            }

            checkinOptions.AuthorTfsUserId = a.TfsUserId;
            Trace.TraceInformation("Commit was authored by git user {0} {1} ({2})", a.Name, a.Email, a.TfsUserId);
        }
コード例 #3
0
        public CheckinOptions BuildCommitSpecificCheckinOptions(CheckinOptions sourceCheckinOptions, string commitMessage, GitCommit commit)
        {
            var customCheckinOptions = Clone(sourceCheckinOptions);

            customCheckinOptions.CheckinComment = commitMessage;

            ProcessWorkItemCommands(customCheckinOptions, writer);

            ProcessCheckinNoteCommands(customCheckinOptions, writer);

            ProcessForceCommand(customCheckinOptions, writer);

            ProcessAuthor(customCheckinOptions, writer, commit);

            return customCheckinOptions;
        }
コード例 #4
0
        private void ProcessAuthor(CheckinOptions checkinOptions, TextWriter writer, GitCommit commit)
        {
            if (checkinOptions.AuthorsFilePath == null)
            {
                writer.WriteLine("Author file was not set.");
                return;
            }

            // get authors file FIXME
            AuthorsFile af = new AuthorsFile();
            TextReader tr = new StreamReader(checkinOptions.AuthorsFilePath);
            af.Parse(tr);

            Author a = af.FindAuthor(commit.AuthorAndEmail);
            if (a == null)
            {
                checkinOptions.AuthorTfsUserId = null;
                return;
            }

            checkinOptions.AuthorTfsUserId = a.TfsUserId;
            writer.WriteLine("Commit was authored by git user {0} {1} ({2})", a.Name, a.Email, a.TfsUserId);
        }
コード例 #5
0
ファイル: Rcheckin.cs プロジェクト: devopsteamberlin/git-tfs
 private string FindTfsRepositoryPathOfMergedBranch(IGitTfsRemote remoteToCheckin, GitCommit[] gitParents, string target)
 {
     if (gitParents.Length != 0)
     {
         _stdout.WriteLine("Working on the merge commit: " + target);
         if (gitParents.Length > 1)
             _stdout.WriteLine("warning: only 1 parent is supported by TFS for a merge changeset. The other parents won't be materialized in the TFS merge!");
         foreach (var gitParent in gitParents)
         {
             var tfsCommit = _globals.Repository.GetTfsCommit(gitParent);
             if (tfsCommit != null)
                 return tfsCommit.Remote.TfsRepositoryPath;
             var lastCheckinCommit = _globals.Repository.GetLastParentTfsCommits(gitParent.Sha).FirstOrDefault();
             if (lastCheckinCommit != null)
             {
                 if(!ForceCheckin && lastCheckinCommit.Remote.Id != remoteToCheckin.Id)
                     throw new GitTfsException("error: the merged branch '" + lastCheckinCommit.Remote.Id
                         + "' is a TFS tracked branch ("+lastCheckinCommit.Remote.TfsRepositoryPath
                         + ") with some commits not checked in.\nIn this case, the local merge won't be materialized as a merge in tfs...")
                         .WithRecommendation("check in all the commits of the tfs merged branch in TFS before trying to check in a merge commit",
                         "use --ignore-merge option to ignore merged TFS branch and check in commit as a normal changeset (not a merge).");
             }
             else
             {
                 _stdout.WriteLine("warning: the parent " + gitParent + " does not belong to a TFS tracked branch (not checked in TFS) and will be ignored!");
             }
         }
     }
     return null;
 }
コード例 #6
0
ファイル: Rcheckin.cs プロジェクト: devopsteamberlin/git-tfs
 public string BuildCommitMessage(GitCommit commit, bool generateCheckinComment, string latest)
 {
     return generateCheckinComment
                        ? _globals.Repository.GetCommitMessage(commit.Sha, latest)
                        : _globals.Repository.GetCommit(commit.Sha).Message;
 }
コード例 #7
0
        private void ProcessAuthor(CheckinOptions checkinOptions, TextWriter writer, GitCommit commit)
        {
            if (!authors.IsParseSuccessfull)
                return;

            Author a = authors.FindAuthor(commit.AuthorAndEmail);
            if (a == null)
            {
                checkinOptions.AuthorTfsUserId = null;
                return;
            }

            checkinOptions.AuthorTfsUserId = a.TfsUserId;
            writer.WriteLine("Commit was authored by git user {0} {1} ({2})", a.Name, a.Email, a.TfsUserId);
        }
コード例 #8
0
        private void ProcessAuthor(CheckinOptions checkinOptions, TextWriter writer, GitCommit commit)
        {
            // get authors file FIXME
            AuthorsFile af = new AuthorsFile();
            if (!af.Parse(checkinOptions.AuthorsFilePath, globals.GitDir))
                return;

            Author a = af.FindAuthor(commit.AuthorAndEmail);
            if (a == null)
            {
                checkinOptions.AuthorTfsUserId = null;
                return;
            }

            checkinOptions.AuthorTfsUserId = a.TfsUserId;
            writer.WriteLine("Commit was authored by git user {0} {1} ({2})", a.Name, a.Email, a.TfsUserId);
        }
コード例 #9
0
 public TfsChangesetInfo GetTfsCommit(GitCommit commit)
 {
     return(TryParseChangesetInfo(commit.Message, commit.Sha));
 }