mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 16:08:34 +02:00
want
This commit is contained in:
parent
3246649cb6
commit
f507ceb152
2 changed files with 43 additions and 50 deletions
|
@ -425,6 +425,7 @@ var commandConfig = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(generalArgs);
|
||||||
command.validateArgBounds(generalArgs, 1, 1);
|
command.validateArgBounds(generalArgs, 1, 1);
|
||||||
|
|
||||||
engine.checkout(engine.crappyUnescape(generalArgs[0]));
|
engine.checkout(engine.crappyUnescape(generalArgs[0]));
|
||||||
|
|
|
@ -99,7 +99,6 @@ var commandConfig = {
|
||||||
regex: /^hg (bookmarks|bookmark|book)($|\s)/,
|
regex: /^hg (bookmarks|bookmark|book)($|\s)/,
|
||||||
options: [
|
options: [
|
||||||
'-r',
|
'-r',
|
||||||
'-m',
|
|
||||||
'-f',
|
'-f',
|
||||||
'-d'
|
'-d'
|
||||||
],
|
],
|
||||||
|
@ -109,59 +108,52 @@ var commandConfig = {
|
||||||
var branchName;
|
var branchName;
|
||||||
var rev;
|
var rev;
|
||||||
|
|
||||||
|
var delegate = { vcs: 'git' };
|
||||||
|
|
||||||
|
if (options['-m'] && options['-d']) {
|
||||||
|
throw new GitError({
|
||||||
|
msg: '-m and -d are incompatible'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (options['-d'] && options['-r']) {
|
||||||
|
throw new GitError({
|
||||||
|
msg: '-r is incompatible with -d'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (options['-m'] && options['-r']) {
|
||||||
|
throw new GitError({
|
||||||
|
msg: '-r is incompatible with -m'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (generalArgs.length + (options['-r'] ? options['-r'].length : 0) +
|
||||||
|
(options['-d'] ? options['-d'].length : 0) === 0) {
|
||||||
|
throw new GitError({
|
||||||
|
msg: 'bookmark name required'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options['-d']) {
|
||||||
|
options['-D'] = options['-d'];
|
||||||
|
delete options['-d'];
|
||||||
|
delegate.name = 'branch';
|
||||||
|
} else {
|
||||||
if (options['-r']) {
|
if (options['-r']) {
|
||||||
// we specified a revision with -r but
|
// we specified a revision with -r but
|
||||||
// need to flip the order
|
// need to flip the order
|
||||||
branchName = options['-r'][1] || '';
|
branchName = options['-r'][1] || '';
|
||||||
rev = options['-r'][0] || '';
|
rev = options['-r'][0] || '';
|
||||||
command.setSupportedMap({
|
delegate.name = 'branch';
|
||||||
'-b': [branchName, rev]
|
command.setGeneralArgs([branchName, rev]);
|
||||||
});
|
} else if (generalArgs.length > 0) {
|
||||||
return {
|
command.setSupportedMap({'-b': [generalArgs[0]]});
|
||||||
vcs: 'git',
|
delegate.name = 'checkout';
|
||||||
name: 'checkout'
|
command.setGeneralArgs([]);
|
||||||
};
|
} else {
|
||||||
} else if (options['-f']) {
|
delegate.name = 'branch';
|
||||||
// TODO sid0 -- also assuming that
|
|
||||||
// bookmark -f <REV> <name> is
|
|
||||||
// the order here
|
|
||||||
branchName = options['-f'][1] || '';
|
|
||||||
rev = options['-f'][0] || '';
|
|
||||||
command.setSupportedMap({
|
|
||||||
'-f': [branchName, rev]
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
vcs: 'git',
|
|
||||||
name: 'branch'
|
|
||||||
};
|
|
||||||
} else if (options['-d']) {
|
|
||||||
return {
|
|
||||||
vcs: 'git',
|
|
||||||
name: 'branch'
|
|
||||||
};
|
|
||||||
} else if (options['-m']) {
|
|
||||||
// TODO sid0 -- order is -r <oldname> <newname>
|
|
||||||
var oldName = options['-m'][0] || '';
|
|
||||||
var newName = options['-m'][1] || '';
|
|
||||||
return {multiDelegate: [{
|
|
||||||
vcs: 'git',
|
|
||||||
name: 'checkout',
|
|
||||||
options: {
|
|
||||||
'-b': [newName, oldName]
|
|
||||||
}
|
}
|
||||||
}, {
|
|
||||||
vcs: 'git',
|
|
||||||
name: 'branch',
|
|
||||||
options: {
|
|
||||||
'-d': [oldName]
|
|
||||||
}
|
|
||||||
}]};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return delegate;
|
||||||
vcs: 'git',
|
|
||||||
name: 'branch'
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue