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: {
|
||||
'--amend': false,
|
||||
'-a': false, // warning
|
||||
'-am': false
|
||||
'-am': false, // warning
|
||||
'-m': false
|
||||
},
|
||||
log: {},
|
||||
add: {},
|
||||
|
|
39
src/git.js
39
src/git.js
|
@ -224,14 +224,49 @@ GitEngine.prototype.reset = function(target) {
|
|||
|
||||
GitEngine.prototype.commitStarter = function() {
|
||||
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']) {
|
||||
this.command.addWarning('No need to add files in this demo');
|
||||
}
|
||||
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();
|
||||
if (msg) {
|
||||
msg = msg
|
||||
.replace(/"/g, '"')
|
||||
.replace(/^"/g, '')
|
||||
.replace(/"$/g, '');
|
||||
|
||||
newCommit.set('commitMessage', msg);
|
||||
}
|
||||
animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit);
|
||||
};
|
||||
|
||||
|
@ -492,6 +527,7 @@ GitEngine.prototype.rebaseStarter = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.rebaseAnimation = function(response) {
|
||||
// TODO: move to animation factory
|
||||
var start = function() {
|
||||
// maybe search stuff??
|
||||
};
|
||||
|
@ -868,7 +904,6 @@ GitEngine.prototype.log = function(ref) {
|
|||
pQueue.sort(this.idSortFunc);
|
||||
}
|
||||
|
||||
toDump.reverse();
|
||||
// now go through and collect logs
|
||||
var bigLogStr = '';
|
||||
_.each(toDump, function(c) {
|
||||
|
|
49
src/tree.js
49
src/tree.js
|
@ -339,9 +339,14 @@ var VisNode = Backbone.Model.extend({
|
|||
depth: undefined,
|
||||
maxWidth: null,
|
||||
outgoingEdges: null,
|
||||
|
||||
circle: null,
|
||||
text: null,
|
||||
|
||||
id: null,
|
||||
pos: null,
|
||||
radius: null,
|
||||
|
||||
commit: null,
|
||||
animationSpeed: GRAPHICS.defaultAnimationTime,
|
||||
animationEasing: GRAPHICS.defaultEasing
|
||||
|
@ -392,6 +397,7 @@ var VisNode = Backbone.Model.extend({
|
|||
|
||||
toFront: function() {
|
||||
this.get('circle').toFront();
|
||||
this.get('text').toFront();
|
||||
},
|
||||
|
||||
getOpacity: function() {
|
||||
|
@ -408,14 +414,26 @@ var VisNode = Backbone.Model.extend({
|
|||
return map[stat];
|
||||
},
|
||||
|
||||
getTextScreenCoords: function() {
|
||||
return this.getScreenCoords();
|
||||
},
|
||||
|
||||
getAttributes: function() {
|
||||
var pos = this.getScreenCoords();
|
||||
var textPos = this.getTextScreenCoords();
|
||||
var opacity = this.getOpacity();
|
||||
|
||||
return {
|
||||
circle: {
|
||||
cx: pos.x,
|
||||
cy: pos.y,
|
||||
opacity: this.getOpacity(),
|
||||
opacity: opacity,
|
||||
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) {
|
||||
this.get('circle').stop().animate(
|
||||
attr.circle,
|
||||
speed !== undefined ? speed : this.get('animationSpeed'),
|
||||
easing || this.get('animationEasing')
|
||||
);
|
||||
var s = speed !== undefined ? speed : this.get('animationSpeed');
|
||||
var e = easing || this.get('animationEasing');
|
||||
|
||||
this.get('circle').stop().animate(attr.circle, s, e);
|
||||
this.get('text').stop().animate(attr.text, s, e);
|
||||
},
|
||||
|
||||
getScreenCoords: function() {
|
||||
|
@ -456,6 +474,11 @@ var VisNode = Backbone.Model.extend({
|
|||
opacity: 0,
|
||||
r: 0,
|
||||
});
|
||||
this.get('text').attr({
|
||||
x: parentCoords.x,
|
||||
y: parentCoords.y,
|
||||
opacity: 0,
|
||||
});
|
||||
},
|
||||
|
||||
setBirth: function() {
|
||||
|
@ -489,16 +512,26 @@ var VisNode = Backbone.Model.extend({
|
|||
},
|
||||
|
||||
parentInFront: function() {
|
||||
// woof!
|
||||
this.get('commit').get('parents')[0].get('visNode').get('circle').toFront();
|
||||
// woof! talk about bad data access
|
||||
this.get('commit').get('parents')[0].get('visNode').toFront();
|
||||
},
|
||||
|
||||
genGraphics: function(paper) {
|
||||
var pos = this.getScreenCoords();
|
||||
var textPos = this.getTextScreenCoords();
|
||||
|
||||
var circle = cuteSmallCircle(paper, pos.x, pos.y, {
|
||||
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('text', text);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue