mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 16:38:50 +02:00
right commit messages
This commit is contained in:
parent
311e429ba3
commit
2866ff38bb
3 changed files with 80 additions and 11 deletions
|
@ -242,7 +242,8 @@ OptionParser.prototype.getMasterOptionMap = function() {
|
||||||
commit: {
|
commit: {
|
||||||
'--amend': false,
|
'--amend': false,
|
||||||
'-a': false, // warning
|
'-a': false, // warning
|
||||||
'-am': false
|
'-am': false, // warning
|
||||||
|
'-m': false
|
||||||
},
|
},
|
||||||
log: {},
|
log: {},
|
||||||
add: {},
|
add: {},
|
||||||
|
|
39
src/git.js
39
src/git.js
|
@ -224,14 +224,49 @@ GitEngine.prototype.reset = function(target) {
|
||||||
|
|
||||||
GitEngine.prototype.commitStarter = function() {
|
GitEngine.prototype.commitStarter = function() {
|
||||||
this.acceptNoGeneralArgs();
|
this.acceptNoGeneralArgs();
|
||||||
|
if (this.commandOptions['-am'] && (
|
||||||
|
this.commandOptions['-a'] || this.commandOptions['-m'])) {
|
||||||
|
throw new GitError({
|
||||||
|
msg: "You can't have -am with another -m or -a!"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var msg = null;
|
||||||
if (this.commandOptions['-a']) {
|
if (this.commandOptions['-a']) {
|
||||||
this.command.addWarning('No need to add files in this demo');
|
this.command.addWarning('No need to add files in this demo');
|
||||||
}
|
}
|
||||||
if (this.commandOptions['-am']) {
|
if (this.commandOptions['-am']) {
|
||||||
this.command.addWarning("Don't worry about adding files or commit messages in this demo");
|
var args = this.commandOptions['-am'];
|
||||||
|
if (args.length > 1) {
|
||||||
|
throw new GitError({
|
||||||
|
msg: "Commit -am doesn't make sense with more than one arg..."
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.command.addWarning("Don't worry about adding files in this demo. I'll take " +
|
||||||
|
"down your commit message but it's not important");
|
||||||
|
msg = args[0];
|
||||||
|
}
|
||||||
|
if (this.commandOptions['-m']) {
|
||||||
|
var args = this.commandOptions['-m'];
|
||||||
|
if (args.length > 1) {
|
||||||
|
throw new GitError({
|
||||||
|
msg: "Specifying a commit message with more than 1 arg doesnt make sense!"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = args[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
var newCommit = this.commit();
|
var newCommit = this.commit();
|
||||||
|
if (msg) {
|
||||||
|
msg = msg
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/^"/g, '')
|
||||||
|
.replace(/"$/g, '');
|
||||||
|
|
||||||
|
newCommit.set('commitMessage', msg);
|
||||||
|
}
|
||||||
animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit);
|
animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -492,6 +527,7 @@ GitEngine.prototype.rebaseStarter = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.rebaseAnimation = function(response) {
|
GitEngine.prototype.rebaseAnimation = function(response) {
|
||||||
|
// TODO: move to animation factory
|
||||||
var start = function() {
|
var start = function() {
|
||||||
// maybe search stuff??
|
// maybe search stuff??
|
||||||
};
|
};
|
||||||
|
@ -868,7 +904,6 @@ GitEngine.prototype.log = function(ref) {
|
||||||
pQueue.sort(this.idSortFunc);
|
pQueue.sort(this.idSortFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
toDump.reverse();
|
|
||||||
// now go through and collect logs
|
// now go through and collect logs
|
||||||
var bigLogStr = '';
|
var bigLogStr = '';
|
||||||
_.each(toDump, function(c) {
|
_.each(toDump, function(c) {
|
||||||
|
|
49
src/tree.js
49
src/tree.js
|
@ -339,9 +339,14 @@ var VisNode = Backbone.Model.extend({
|
||||||
depth: undefined,
|
depth: undefined,
|
||||||
maxWidth: null,
|
maxWidth: null,
|
||||||
outgoingEdges: null,
|
outgoingEdges: null,
|
||||||
|
|
||||||
|
circle: null,
|
||||||
|
text: null,
|
||||||
|
|
||||||
id: null,
|
id: null,
|
||||||
pos: null,
|
pos: null,
|
||||||
radius: null,
|
radius: null,
|
||||||
|
|
||||||
commit: null,
|
commit: null,
|
||||||
animationSpeed: GRAPHICS.defaultAnimationTime,
|
animationSpeed: GRAPHICS.defaultAnimationTime,
|
||||||
animationEasing: GRAPHICS.defaultEasing
|
animationEasing: GRAPHICS.defaultEasing
|
||||||
|
@ -392,6 +397,7 @@ var VisNode = Backbone.Model.extend({
|
||||||
|
|
||||||
toFront: function() {
|
toFront: function() {
|
||||||
this.get('circle').toFront();
|
this.get('circle').toFront();
|
||||||
|
this.get('text').toFront();
|
||||||
},
|
},
|
||||||
|
|
||||||
getOpacity: function() {
|
getOpacity: function() {
|
||||||
|
@ -408,14 +414,26 @@ var VisNode = Backbone.Model.extend({
|
||||||
return map[stat];
|
return map[stat];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getTextScreenCoords: function() {
|
||||||
|
return this.getScreenCoords();
|
||||||
|
},
|
||||||
|
|
||||||
getAttributes: function() {
|
getAttributes: function() {
|
||||||
var pos = this.getScreenCoords();
|
var pos = this.getScreenCoords();
|
||||||
|
var textPos = this.getTextScreenCoords();
|
||||||
|
var opacity = this.getOpacity();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
circle: {
|
circle: {
|
||||||
cx: pos.x,
|
cx: pos.x,
|
||||||
cy: pos.y,
|
cy: pos.y,
|
||||||
opacity: this.getOpacity(),
|
opacity: opacity,
|
||||||
r: this.getRadius()
|
r: this.getRadius()
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
x: textPos.x,
|
||||||
|
y: textPos.y,
|
||||||
|
opacity: opacity
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -426,11 +444,11 @@ var VisNode = Backbone.Model.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
animateFromAttr: function(attr, speed, easing) {
|
animateFromAttr: function(attr, speed, easing) {
|
||||||
this.get('circle').stop().animate(
|
var s = speed !== undefined ? speed : this.get('animationSpeed');
|
||||||
attr.circle,
|
var e = easing || this.get('animationEasing');
|
||||||
speed !== undefined ? speed : this.get('animationSpeed'),
|
|
||||||
easing || this.get('animationEasing')
|
this.get('circle').stop().animate(attr.circle, s, e);
|
||||||
);
|
this.get('text').stop().animate(attr.text, s, e);
|
||||||
},
|
},
|
||||||
|
|
||||||
getScreenCoords: function() {
|
getScreenCoords: function() {
|
||||||
|
@ -456,6 +474,11 @@ var VisNode = Backbone.Model.extend({
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
r: 0,
|
r: 0,
|
||||||
});
|
});
|
||||||
|
this.get('text').attr({
|
||||||
|
x: parentCoords.x,
|
||||||
|
y: parentCoords.y,
|
||||||
|
opacity: 0,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
setBirth: function() {
|
setBirth: function() {
|
||||||
|
@ -489,16 +512,26 @@ var VisNode = Backbone.Model.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
parentInFront: function() {
|
parentInFront: function() {
|
||||||
// woof!
|
// woof! talk about bad data access
|
||||||
this.get('commit').get('parents')[0].get('visNode').get('circle').toFront();
|
this.get('commit').get('parents')[0].get('visNode').toFront();
|
||||||
},
|
},
|
||||||
|
|
||||||
genGraphics: function(paper) {
|
genGraphics: function(paper) {
|
||||||
var pos = this.getScreenCoords();
|
var pos = this.getScreenCoords();
|
||||||
|
var textPos = this.getTextScreenCoords();
|
||||||
|
|
||||||
var circle = cuteSmallCircle(paper, pos.x, pos.y, {
|
var circle = cuteSmallCircle(paper, pos.x, pos.y, {
|
||||||
radius: this.getRadius()
|
radius: this.getRadius()
|
||||||
});
|
});
|
||||||
|
var text = paper.text(textPos.x, textPos.y, String(this.get('id')));
|
||||||
|
text.attr({
|
||||||
|
'font-size': 12,
|
||||||
|
'font-family': 'Monaco, Courier, font-monospace',
|
||||||
|
opacity: this.getOpacity()
|
||||||
|
});
|
||||||
|
|
||||||
this.set('circle', circle);
|
this.set('circle', circle);
|
||||||
|
this.set('text', text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue