forked from nodegit/nodegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrevert.js
More file actions
46 lines (42 loc) · 1.11 KB
/
revert.js
File metadata and controls
46 lines (42 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var NodeGit = require("../");
var normalizeOptions = NodeGit.Utils.normalizeOptions;
var Revert = NodeGit.Revert;
var _commit = Revert.commit;
/**
* Reverts the given commit against the given "our" commit, producing an index
* that reflects the result of the revert.
*
* @async
* @param {Repository} repo the repository that contains the given commits.
* @param {Commit} revert_commit the commit to revert
* @param {Commit} our_commit the commit to revert against (e.g. HEAD)
* @param {Number} mainline the parent of the revert commit, if it is a merge
* @param {MergeOptions} merge_options the merge options (or null for defaults)
*
* @return {Index} the index result
*/
Revert.commit = function(
repo,
revert_commit,
our_commit,
mainline,
merge_options,
callback
)
{
merge_options = normalizeOptions(merge_options, NodeGit.MergeOptions);
return _commit.call(
this,
repo,
revert_commit,
our_commit,
mainline,
merge_options
)
.then(function(result) {
if (typeof callback === "function") {
callback(null, result);
}
return result;
}, callback);
};