simple-git
Advanced tools
Comparing version 1.18.0 to 1.19.0
{ | ||
"name": "simple-git", | ||
"description": "Simple GIT interface for node.js", | ||
"version": "1.18.0", | ||
"version": "1.19.0", | ||
"author": "Steve King <steve@mydev.co>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -67,2 +67,5 @@ # Simple Git | ||
`.mergeFromTo(from, to, [[options,] handlerFn])` merge from one branch to another, when supplied the options should be | ||
an array of additional parameters to pass into the `git merge` command. | ||
`.push(remote, branch, handlerFn)` pushes to a named remote and named branch | ||
@@ -69,0 +72,0 @@ |
@@ -480,2 +480,41 @@ (function () { | ||
/** | ||
* Merges from one branch to another, equivalent to running `git merge ${from} $[to}`, the `options` argument can | ||
* either be an array of additional parameters to pass to the command or null / omitted to be ignored. | ||
* | ||
* @param {string} from | ||
* @param {string} to | ||
* @param {Object} [options] | ||
* @param {Function} [then] | ||
*/ | ||
Git.prototype.mergeFromTo = function (from, to, options, then) { | ||
var commands = [ | ||
from, | ||
to | ||
]; | ||
var callback = Git.trailingFunctionArgument(arguments); | ||
if (Array.isArray(options)) { | ||
commands = commands.concat(options); | ||
} | ||
return this.merge(commands, callback); | ||
}; | ||
Git.prototype.merge = function (options, then) { | ||
if (!Array.isArray(options)) { | ||
return this.then(function () { | ||
then && then(new TypeError("Git.merge requires an array of arguments")); | ||
}); | ||
} | ||
if (options[0] !== 'merge') { | ||
options.unshift('merge'); | ||
} | ||
return this._run(options, function (err, data) { | ||
then && then(err || null, err ? null : data); | ||
}); | ||
}; | ||
/** | ||
* Call any `git tag` function with arguments passed as an array of strings. | ||
@@ -482,0 +521,0 @@ * |
@@ -228,2 +228,45 @@ | ||
exports.merge = { | ||
setUp: function (done) { | ||
Instance(); | ||
done(); | ||
}, | ||
merge: function (test) { | ||
git.merge(['--no-ff', 'someOther-master'], function (err) { | ||
test.same(['merge', '--no-ff', 'someOther-master'], theCommandRun()); | ||
test.done(); | ||
}); | ||
closeWith('Merge made by the \'recursive\' strategy.\n\ | ||
src/File.js | 16 ++++++++++++----\n\ | ||
test/fileTest.js | 24 ++++++++++++++++++++++++\n\ | ||
2 files changed, 36 insertions(+), 4 deletions(-)\n\ | ||
'); | ||
}, | ||
mergeFromTo: function (test) { | ||
git.mergeFromTo('aaa', 'bbb', function (err) { | ||
test.same(['merge', 'aaa', 'bbb'], theCommandRun()); | ||
test.done(); | ||
}); | ||
closeWith(''); | ||
}, | ||
mergeFromToWithOptions: function (test) { | ||
git.mergeFromTo('aaa', 'bbb', ['x', 'y'], function (err) { | ||
test.same(['merge', 'aaa', 'bbb', 'x', 'y'], theCommandRun()); | ||
test.done(); | ||
}); | ||
closeWith(''); | ||
}, | ||
mergeFromToWithBadOptions: function (test) { | ||
git.mergeFromTo('aaa', 'bbb', 'x', function (err) { | ||
test.same(['merge', 'aaa', 'bbb'], theCommandRun()); | ||
test.done(); | ||
}); | ||
closeWith(''); | ||
} | ||
}; | ||
exports.remotes = { | ||
@@ -230,0 +273,0 @@ setUp: function (done) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57297
1377
178