misc work

This commit is contained in:
Peter Cottle 2013-10-06 14:30:50 -07:00
parent 906216d98b
commit 1ed8a2524a
8 changed files with 350 additions and 13 deletions

View file

@ -151,6 +151,25 @@ var commandConfig = {
}
},
remote: {
regex: /^git +remote($|\s)/,
options: [
'-v'
],
execute: function(engine, command) {
command.acceptNoGeneralArgs();
if (!engine.hasOrigin()) {
throw new CommandResult({
msg: ''
});
}
engine.printRemotes({
verbose: !!command.getOptionsMap()['-v']
});
}
},
fetch: {
regex: /^git +fetch *?$/,
execute: function(engine, command) {
@ -159,7 +178,13 @@ var commandConfig = {
msg: intl.str('git-error-origin-required')
});
}
command.acceptNoGeneralArgs();
var generalArgs = command.getGeneralArgs();
command.oneArgImpliedOrigin(generalArgs);
if (generalArgs[0] !== 'origin') {
throw new GitError({
msg: intl.str('git-error-options')
});
}
engine.fetch();
}
},

View file

@ -17,6 +17,7 @@ var CommandResult = Errors.CommandResult;
var EventBaton = require('../util/eventBaton').EventBaton;
var ORIGIN_PREFIX = 'o/';
var TAB = '   ';
function GitEngine(options) {
this.rootCommit = null;
@ -601,6 +602,21 @@ GitEngine.prototype.printBranches = function(branches) {
});
};
GitEngine.prototype.printRemotes = function(options) {
var result = '';
if (options.verbose) {
result += 'origin (fetch)\n';
result += TAB + 'git@github.com:pcottle/foo.git' + '\n\n';
result += 'origin (push)\n';
result += TAB + 'git@github.com:pcottle/foo.git';
} else {
result += 'origin';
}
throw new CommandResult({
msg: result
});
};
GitEngine.prototype.getUniqueID = function() {
var id = this.uniqueId('C');
@ -2141,7 +2157,7 @@ GitEngine.prototype.status = function() {
}
lines.push('Changes to be committed:');
lines.push('');
lines.push('    modified: cal/OskiCostume.stl');
lines.push(TAB + 'modified: cal/OskiCostume.stl');
lines.push('');
lines.push(intl.str('git-status-readytocommit'));

View file

@ -358,7 +358,10 @@ TreeCompare.reduceTreeFields = function(trees) {
target: tree.HEAD.target,
id: tree.HEAD.id
};
});
if (tree.originTree) {
this.reduceTreeFields([tree.originTree]);
}
}, this);
};
TreeCompare.compareTrees = function(treeA, treeB) {