Skip to content
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 numberDiff line numberDiff 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 DownExpand 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 DownExpand 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 DownExpand 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 DownExpand 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