Skip to content

Add additional sha, parent, and message information to head info box #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions js/historyview.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ define(['d3'], function() {
* @param container {String} selector for the container to render the SVG into
*/
render: function(container) {
var svgContainer, svg;
var svgContainer, svg, display;

svgContainer = container.append('div')
.classed('svg-container', true)
Expand Down Expand Up @@ -547,6 +547,22 @@ define(['d3'], function() {
.classed('current-branch-display', true)
.attr('x', 10)
.attr('y', 45);

display = svg.select('text.current-branch-display');

display.append('svg:tspan')
.attr('x','10')
.attr('dy', '1.2em');
display.append('svg:tspan')
.attr('x','10')
.attr('dy', '1.2em');
display.append('svg:tspan')
.attr('x','10')
.attr('dy', '1.2em');
display.append('svg:tspan')
.attr('x','10')
.attr('dy', '1.2em');

}

this.svgContainer = svgContainer;
Expand All @@ -558,6 +574,7 @@ define(['d3'], function() {
this.renderCommits();

this._setCurrentBranch(this.currentBranch);
this._setCurrentCommit();
},

destroy: function() {
Expand Down Expand Up @@ -965,7 +982,7 @@ define(['d3'], function() {
},

_setCurrentBranch: function(branch) {
var display = this.svg.select('text.current-branch-display'),
var display = this.svg.select('text.current-branch-display > tspan'),
text = 'HEAD: ';

if (branch && branch.indexOf('/') === -1) {
Expand All @@ -975,8 +992,20 @@ define(['d3'], function() {
text += ' (detached head)';
this.currentBranch = null;
}

d3.select(display[0][0]).text(text);
},

display.text(text);
_setCurrentCommit: function() {
var display = this.svg.selectAll('text.current-branch-display > tspan');

//this will error out without checking first to see if commit exits, possible async issue?
if(this.getCommit('HEAD')) {
d3.select(display[0][1]).text('Sha: ' + this.getCommit('HEAD').id);
d3.select(display[0][2]).text('Parent: ' + this.getCommit('HEAD').parent);
d3.select(display[0][3]).text('Message: ' + this.getCommit('HEAD').message);
}

},

addReflogEntry: function(ref, destination, reason) {
Expand Down Expand Up @@ -1265,7 +1294,7 @@ define(['d3'], function() {

checkout: function(ref) {
var commit = this.getCommit(ref);

if (!commit) {
throw new Error('Cannot find commit: ' + ref);
}
Expand All @@ -1279,6 +1308,7 @@ define(['d3'], function() {

var isBranch = this.branches.indexOf(ref) !== -1
this._setCurrentBranch(isBranch ? ref : null);
this._setCurrentCommit();
this.moveTag('HEAD', commit.id);
this.renderTags();

Expand Down Expand Up @@ -1479,6 +1509,7 @@ define(['d3'], function() {
this.moveTag(origBranch, newHeadCommit.id)
this.reset(origBranch)
this._setCurrentBranch(origBranch)
this._setCurrentCommit()
this.addReflogEntry(
'HEAD', targetCommit.id, 'rebase finished: returning to resf/heads/' + origBranch
)
Expand Down