FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/lib/remote.js at master · codercatdev/nodegit · GitHub
codercatdev
nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
lib
/
remote.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
178 lines (158 loc) · 4.74 KB
Breadcrumbs
nodegit
/
lib
/
remote.js
Copy path
File metadata and controls
178 lines (158 loc) · 4.74 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
var
NodeGit
=
require
(
"../"
)
;
var
normalizeFetchOptions
=
NodeGit
.
Utils
.
normalizeFetchOptions
;
var
normalizeOptions
=
NodeGit
.
Utils
.
normalizeOptions
;
var
lookupWrapper
=
NodeGit
.
Utils
.
lookupWrapper
;
var
shallowClone
=
NodeGit
.
Utils
.
shallowClone
;
var
Remote
=
NodeGit
.
Remote
;
var
_connect
=
Remote
.
prototype
.
connect
;
var
_download
=
Remote
.
prototype
.
download
;
var
_fetch
=
Remote
.
prototype
.
fetch
;
var
_push
=
Remote
.
prototype
.
push
;
var
_upload
=
Remote
.
prototype
.
upload
;
/**
* 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
)
;
/**
* Connects to a remote
*
*
@async
*
@param
{
Enums.DIRECTION
} direction The direction for the connection
*
@param
{
RemoteCallbacks
} callbacks The callback functions for the connection
*
@param
{
ProxyOptions
} proxyOpts Proxy settings
*
@param
{
Array<string>
} customHeaders extra HTTP headers to use
*
@param
{
Function
} callback
*
@return
{
Number
} error code
*/
Remote
.
prototype
.
connect
=
function
(
direction
,
callbacks
,
proxyOpts
,
customHeaders
)
{
callbacks
=
normalizeOptions
(
callbacks
||
{
}
,
NodeGit
.
RemoteCallbacks
)
;
proxyOpts
=
normalizeOptions
(
proxyOpts
||
{
}
,
NodeGit
.
ProxyOptions
)
;
customHeaders
=
customHeaders
||
[
]
;
return
_connect
.
call
(
this
,
direction
,
callbacks
,
proxyOpts
,
customHeaders
)
;
}
;
/**
* Connects to a remote
*
*
@async
*
@param
{
Array
} refSpecs The ref specs that should be pushed
*
@param
{
FetchOptions
} opts The fetch options for download, contains callbacks
*
@param
{
Function
} callback
*
@return
{
Number
} error code
*/
Remote
.
prototype
.
download
=
function
(
refspecs
,
opts
)
{
return
_download
.
call
(
this
,
refspecs
,
normalizeFetchOptions
(
opts
)
)
;
}
;
/**
* Connects to a remote
*
*
@async
*
@param
{
Array
} refSpecs The ref specs that should be pushed
*
@param
{
FetchOptions
} opts The fetch options for download, contains callbacks
*
@param
{
String
} message The message to use for the update reflog messages
*
@param
{
Function
} callback
*
@return
{
Number
} error code
*/
Remote
.
prototype
.
fetch
=
function
(
refspecs
,
opts
,
reflog_message
)
{
return
_fetch
.
call
(
this
,
refspecs
,
normalizeFetchOptions
(
opts
)
,
reflog_message
)
;
}
;
/**
* Pushes to a remote
*
*
@async
*
@param
{
Array
} refSpecs The ref specs that should be pushed
*
@param
{
PushOptions
} options Options for the checkout
*
@param
{
Function
} callback
*
@return
{
Number
} error code
*/
Remote
.
prototype
.
push
=
function
(
refSpecs
,
opts
)
{
var
callbacks
;
var
proxyOpts
;
if
(
opts
)
{
opts
=
shallowClone
(
opts
)
;
callbacks
=
opts
.
callbacks
;
proxyOpts
=
opts
.
proxyOpts
;
delete
opts
.
callbacks
;
delete
opts
.
proxyOpts
;
}
else
{
opts
=
{
}
;
}
opts
=
normalizeOptions
(
opts
,
NodeGit
.
PushOptions
)
;
if
(
callbacks
)
{
opts
.
callbacks
=
normalizeOptions
(
callbacks
,
NodeGit
.
RemoteCallbacks
)
;
}
if
(
proxyOpts
)
{
opts
.
proxyOpts
=
normalizeOptions
(
proxyOpts
,
NodeGit
.
ProxyOptions
)
;
}
return
_push
.
call
(
this
,
refSpecs
,
opts
)
;
}
;
/**
* Lists advertised references from a remote. You must connect to the remote
* before using referenceList.
*
*
@async
*
@return
{
Promise<Array<RemoteHead>>
} a list of the remote heads the remote
* had available at the last established
* connection.
*
*/
Remote
.
prototype
.
referenceList
=
Remote
.
prototype
.
referenceList
;
/**
* Connects to a remote
*
*
@async
*
@param
{
Array
} refSpecs The ref specs that should be pushed
*
@param
{
FetchOptions
} opts The fetch options for download, contains callbacks
*
@param
{
String
} message The message to use for the update reflog messages
*
@param
{
Function
} callback
*
@return
{
Number
} error code
*/
Remote
.
prototype
.
fetch
=
function
(
refspecs
,
opts
,
reflog_message
)
{
return
_fetch
.
call
(
this
,
refspecs
,
normalizeFetchOptions
(
opts
)
,
reflog_message
)
;
}
;
/**
* Pushes to a remote
*
*
@async
*
@param
{
Array
} refSpecs The ref specs that should be pushed
*
@param
{
PushOptions
} options Options for the checkout
*
@param
{
Function
} callback
*
@return
{
Number
} error code
*/
Remote
.
prototype
.
upload
=
function
(
refSpecs
,
opts
)
{
var
callbacks
;
var
proxyOpts
;
if
(
opts
)
{
opts
=
shallowClone
(
opts
)
;
callbacks
=
opts
.
callbacks
;
proxyOpts
=
opts
.
proxyOpts
;
delete
opts
.
callbacks
;
delete
opts
.
proxyOpts
;
}
else
{
opts
=
{
}
;
}
opts
=
normalizeOptions
(
opts
,
NodeGit
.
PushOptions
)
;
if
(
callbacks
)
{
opts
.
callbacks
=
normalizeOptions
(
callbacks
,
NodeGit
.
RemoteCallbacks
)
;
}
if
(
proxyOpts
)
{
opts
.
proxyOpts
=
normalizeOptions
(
proxyOpts
,
NodeGit
.
ProxyOptions
)
;
}
return
_upload
.
call
(
this
,
refSpecs
,
opts
)
;
}
;
Back
|
FazBrowse Home
|
New Git URL