mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 16:08:34 +02:00
zomg so many keys
This commit is contained in:
parent
9048f09d9f
commit
7e165c6fdc
18 changed files with 354 additions and 75 deletions
|
@ -1,4 +1,5 @@
|
|||
var _ = require('underscore');
|
||||
var intl = require('../intl');
|
||||
|
||||
var Errors = require('../util/errors');
|
||||
var CommandProcessError = Errors.CommandProcessError;
|
||||
|
@ -19,12 +20,12 @@ var shortcutMap = {
|
|||
var instantCommands = [
|
||||
[/^git help($|\s)/, function() {
|
||||
var lines = [
|
||||
'Git Version PCOTTLE.1.0',
|
||||
intl.str('git-version'),
|
||||
'<br/>',
|
||||
'Usage:',
|
||||
_.escape('\t git <command> [<args>]'),
|
||||
intl.str('git-usage'),
|
||||
_.escape(intl.str('git-usage-command')),
|
||||
'<br/>',
|
||||
'Supported commands:',
|
||||
intl.str('git-supported-commands'),
|
||||
'<br/>'
|
||||
];
|
||||
var commands = GitOptionParser.prototype.getMasterOptionMap();
|
||||
|
@ -159,7 +160,10 @@ GitOptionParser.prototype.explodeAndSet = function() {
|
|||
// it's an option, check supportedMap
|
||||
if (this.supportedMap[part] === undefined) {
|
||||
throw new CommandProcessError({
|
||||
msg: 'The option "' + part + '" is not supported'
|
||||
msg: intl.str(
|
||||
'option-not-supported',
|
||||
{ option: part }
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ var _ = require('underscore');
|
|||
var Backbone = (!require('../util').isBrowser()) ? Backbone = require('backbone') : Backbone = window.Backbone;
|
||||
var Q = require('q');
|
||||
|
||||
var intl = require('../intl');
|
||||
|
||||
var AnimationFactoryModule = require('../visuals/animation/animationFactory');
|
||||
var AnimationQueue = require('../visuals/animation').AnimationQueue;
|
||||
var TreeCompare = require('./treeCompare').TreeCompare;
|
||||
|
@ -278,19 +280,27 @@ GitEngine.prototype.validateBranchName = function(name) {
|
|||
name = name.replace(/\s/g, '');
|
||||
if (!/^[a-zA-Z0-9]+$/.test(name)) {
|
||||
throw new GitError({
|
||||
msg: 'woah bad branch name!! This is not ok: ' + name
|
||||
msg: intl.str(
|
||||
'bad-branch-name',
|
||||
{ branch: name }
|
||||
)
|
||||
});
|
||||
}
|
||||
if (/[hH][eE][aA][dD]/.test(name)) {
|
||||
throw new GitError({
|
||||
msg: 'branch name of "head" is ambiguous, dont name it that'
|
||||
msg: intl.str(
|
||||
'bad-branch-name',
|
||||
{ branch: name }
|
||||
)
|
||||
});
|
||||
}
|
||||
if (name.length > 9) {
|
||||
name = name.slice(0, 9);
|
||||
this.command.addWarning(
|
||||
'Sorry, we need to keep branch names short for the visuals. Your branch ' +
|
||||
'name was truncated to 9 characters, resulting in ' + name
|
||||
intl.str(
|
||||
'branch-name-short',
|
||||
{ branch: name }
|
||||
)
|
||||
);
|
||||
}
|
||||
return name;
|
||||
|
@ -300,7 +310,10 @@ GitEngine.prototype.makeBranch = function(id, target) {
|
|||
id = this.validateBranchName(id);
|
||||
if (this.refs[id]) {
|
||||
throw new GitError({
|
||||
msg: 'that branch id either matches a commit hash or already exists!'
|
||||
msg: intl.str(
|
||||
'bad-branch-name',
|
||||
{ branch: name }
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue