Skip to content

Commit

Permalink
WIP: try to solve "Blame to previous revision" gitextensions#6605
Browse files Browse the repository at this point in the history
  • Loading branch information
pmiossec committed May 29, 2019
1 parent 5175882 commit 04212cd
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions GitUI/UserControls/BlameControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -551,23 +551,28 @@ private void blamePreviousRevisionToolStripMenuItem_Click(object sender, EventAr

var objectId = _blame.Lines[line].Commit.ObjectId;
int originalLine = _blame.Lines[line].OriginLineNumber;
GitBlame blame = Module.Blame(_fileName, objectId + "^", _encoding, originalLine + ",+1");
if (blame.Lines.Count > 0)
{
var revision = blame.Lines[0].Commit.ObjectId;
if (_revGrid != null)
{
_clickedBlameLine = blame.Lines[0];
_revGrid.SetSelectedRevision(revision);
}
else
{
using (var frm = new FormCommitDiff(UICommands, revision))
{
frm.ShowDialog(this);
}
}
}

// TODO: Finish => blame the direct parent commit from the selected line
// What to do when there are more than 1 parents?!?
_revGrid.SetSelectedRevision(_revGrid.GetRevision(objectId).FirstParentGuid);

////GitBlame blame = Module.Blame(_fileName, objectId + "^", _encoding, originalLine + ",+1");
////if (blame.Lines.Count > 0)
////{
//// var revision = blame.Lines[0].Commit.ObjectId;
//// if (_revGrid != null)
//// {
//// _clickedBlameLine = blame.Lines[0];
//// _revGrid.SetSelectedRevision(revision);
//// }
//// else
//// {
//// using (var frm = new FormCommitDiff(UICommands, revision))
//// {
//// frm.ShowDialog(this);
//// }
//// }
////}
}

private void showChangesToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down

0 comments on commit 04212cd

Please sign in to comment.