public CheckinOptions BuildCommitSpecificCheckinOptions(CheckinOptions sourceCheckinOptions, string commitMessage, GitCommit commit, AuthorsFile authors) { var customCheckinOptions = BuildCommitSpecificCheckinOptions(sourceCheckinOptions, commitMessage); customCheckinOptions.ProcessAuthor(writer, commit, authors); return customCheckinOptions; }
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); }
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; }
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); }
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; }
public string BuildCommitMessage(GitCommit commit, bool generateCheckinComment, string latest) { return generateCheckinComment ? _globals.Repository.GetCommitMessage(commit.Sha, latest) : _globals.Repository.GetCommit(commit.Sha).Message; }
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); }
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); }
public TfsChangesetInfo GetTfsCommit(GitCommit commit) { return(TryParseChangesetInfo(commit.Message, commit.Sha)); }