forked from nodegit/nodegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremote.js
More file actions
44 lines (37 loc) · 1.35 KB
/
remote.js
File metadata and controls
44 lines (37 loc) · 1.35 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
var NodeGit = require("../");
var normalizeOptions = NodeGit.Utils.normalizeOptions;
var lookupWrapper = NodeGit.Utils.lookupWrapper;
var Remote = NodeGit.Remote;
var setCallbacks = Remote.prototype.setCallbacks;
var push = Remote.prototype.push;
/**
* Retrieves the remote by name
* @async
* @param {Repository} repo The repo that the remote lives in
* @param {String|Remote} name The remote to lookup
* @param {Function} callback
* @return {Remote}
*/
Remote.lookup = lookupWrapper(Remote);
Remote.prototype.setCallbacks = function(callbacks) {
callbacks = normalizeOptions(callbacks, NodeGit.RemoteCallbacks);
return setCallbacks.call(this, callbacks);
};
/**
* Pushes to a remote
*
* @async
* @param {Array} refSpecs The ref specs that should be pushed
* @param {PushOptions} options Options for the checkout
* @param {Signature} signature The identity to use for the reflog of the
* updated references
* @param {String} message The message to use for the update reflog messages
* @return {Number} error code
*/
Remote.prototype.push = function(refSpecs, options, signature, message) {
options = normalizeOptions(options, NodeGit.PushOptions);
signature = signature || this.owner().defaultSignature();
message = message || "Push to " + this.name();
return push.call(this, refSpecs, options, signature, message);
};
module.exports = Remote;