Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a49378e2
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a49378e2
编写于
8月 22, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
git: cleaner exports
上级
dbd92aa7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
67 addition
and
60 deletion
+67
-60
extensions/git/src/api/api.ts
extensions/git/src/api/api.ts
+3
-3
extensions/git/src/api/api1.ts
extensions/git/src/api/api1.ts
+27
-22
extensions/git/src/api/extension.ts
extensions/git/src/api/extension.ts
+5
-5
extensions/git/src/api/git.d.ts
extensions/git/src/api/git.d.ts
+32
-30
未找到文件。
extensions/git/src/api/api.ts
浏览文件 @
a49378e2
...
...
@@ -6,17 +6,17 @@
'
use strict
'
;
import
{
Model
}
from
'
../model
'
;
import
{
GitExtension
}
from
'
./git
'
;
import
{
API
}
from
'
./git
'
;
import
*
as
semver
from
'
semver
'
;
interface
ApiCtor
{
new
(
model
:
Model
):
GitExtension
.
API
;
new
(
model
:
Model
):
API
;
}
const
versions
:
string
[]
=
[];
const
apis
=
new
Map
<
string
,
ApiCtor
>
();
export
function
getAPI
(
model
:
Model
,
range
:
string
):
GitExtension
.
API
{
export
function
getAPI
(
model
:
Model
,
range
:
string
):
API
{
if
(
!
range
)
{
throw
new
Error
(
`Please provide a Git extension API version range. Available versions: [
${
versions
.
join
(
'
,
'
)}
]`
);
}
...
...
extensions/git/src/api/api1.ts
浏览文件 @
a49378e2
...
...
@@ -6,57 +6,62 @@
'
use strict
'
;
import
{
Model
}
from
'
../model
'
;
import
{
GitExtension
}
from
'
./git
'
;
import
{
Repository
as
BaseRepository
}
from
'
../repository
'
;
import
{
InputBox
,
ExecResult
,
SpawnOptions
,
Git
,
API
,
Repository
}
from
'
./git
'
;
import
{
Api
}
from
'
./api
'
;
import
{
Event
,
SourceControlInputBox
,
Uri
}
from
'
vscode
'
;
import
{
mapEvent
}
from
'
../util
'
;
import
{
Repository
}
from
'
../repository
'
;
import
*
as
cp
from
'
child_process
'
;
class
ApiInputBox
implements
GitExtension
.
InputBox
{
class
ApiInputBox
implements
InputBox
{
set
value
(
value
:
string
)
{
this
.
_inputBox
.
value
=
value
;
}
get
value
():
string
{
return
this
.
_inputBox
.
value
;
}
constructor
(
private
_inputBox
:
SourceControlInputBox
)
{
}
}
export
class
ApiRepository
implements
GitExtension
.
Repository
{
export
class
ApiRepository
implements
Repository
{
readonly
rootUri
:
Uri
;
readonly
inputBox
:
GitExtension
.
InputBox
;
readonly
inputBox
:
InputBox
;
constructor
(
_repository
:
Repository
)
{
constructor
(
_repository
:
Base
Repository
)
{
this
.
rootUri
=
Uri
.
file
(
_repository
.
root
);
this
.
inputBox
=
new
ApiInputBox
(
_repository
.
inputBox
);
}
}
@
Api
(
'
1.0.0
'
)
export
class
ApiImpl
implements
GitExtension
.
API
{
export
class
ApiGit
implements
Git
{
get
path
():
string
{
return
this
.
_model
.
git
.
path
;
}
constructor
(
private
_model
:
Model
)
{
}
exec
(
cwd
:
string
,
args
:
string
[],
options
:
SpawnOptions
=
{}):
Promise
<
ExecResult
<
string
>>
{
return
this
.
_model
.
git
.
exec
(
cwd
,
args
,
options
);
}
get
gitPath
():
string
{
return
this
.
_model
.
git
.
path
;
spawn
(
cwd
:
string
,
args
:
string
[],
options
:
SpawnOptions
=
{}):
cp
.
ChildProcess
{
options
=
{
cwd
,
...
options
};
return
this
.
_model
.
git
.
spawn
(
args
,
options
);
}
}
get
onDidOpenRepository
():
Event
<
GitExtension
.
Repository
>
{
@
Api
(
'
1.0.0
'
)
export
class
ApiImpl
implements
API
{
readonly
git
=
new
ApiGit
(
this
.
_model
);
get
onDidOpenRepository
():
Event
<
Repository
>
{
return
mapEvent
(
this
.
_model
.
onDidOpenRepository
,
r
=>
new
ApiRepository
(
r
));
}
get
onDidCloseRepository
():
Event
<
GitExtension
.
Repository
>
{
get
onDidCloseRepository
():
Event
<
Repository
>
{
return
mapEvent
(
this
.
_model
.
onDidCloseRepository
,
r
=>
new
ApiRepository
(
r
));
}
get
repositories
():
GitExtension
.
Repository
[]
{
get
repositories
():
Repository
[]
{
return
this
.
_model
.
repositories
.
map
(
r
=>
new
ApiRepository
(
r
));
}
constructor
(
private
_model
:
Model
)
{
}
exec
(
cwd
:
string
,
args
:
string
[],
options
:
GitExtension
.
SpawnOptions
=
{}):
Promise
<
GitExtension
.
IExecResult
<
string
>>
{
return
this
.
_model
.
git
.
exec
(
cwd
,
args
,
options
);
}
spawn
(
cwd
:
string
,
args
:
string
[],
options
:
GitExtension
.
SpawnOptions
=
{}):
cp
.
ChildProcess
{
options
=
{
cwd
,
...
options
};
return
this
.
_model
.
git
.
spawn
(
args
,
options
);
}
}
extensions/git/src/api/extension.ts
浏览文件 @
a49378e2
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
{
Model
}
from
'
../model
'
;
import
{
GitExtension
}
from
'
./git
'
;
import
{
GitExtension
,
Repository
,
API
}
from
'
./git
'
;
import
{
getAPI
,
deprecated
}
from
'
./api
'
;
import
{
ApiRepository
}
from
'
./api1
'
;
...
...
@@ -18,11 +18,11 @@ class NoModelGitExtension implements GitExtension {
}
@
deprecated
async
getRepositories
():
Promise
<
GitExtension
.
Repository
[]
>
{
async
getRepositories
():
Promise
<
Repository
[]
>
{
throw
new
Error
(
'
Git model not found
'
);
}
getAPI
():
GitExtension
.
API
{
getAPI
():
API
{
throw
new
Error
(
'
Git model not found
'
);
}
}
...
...
@@ -37,11 +37,11 @@ class GitExtensionImpl implements GitExtension {
}
@
deprecated
async
getRepositories
():
Promise
<
GitExtension
.
Repository
[]
>
{
async
getRepositories
():
Promise
<
Repository
[]
>
{
return
this
.
_model
.
repositories
.
map
(
repository
=>
new
ApiRepository
(
repository
));
}
getAPI
(
range
:
string
):
GitExtension
.
API
{
getAPI
(
range
:
string
):
API
{
return
getAPI
(
this
.
_model
,
range
);
}
}
...
...
extensions/git/src/api/git.d.ts
浏览文件 @
a49378e2
...
...
@@ -6,41 +6,43 @@
import
{
Uri
,
SourceControlInputBox
,
Event
,
CancellationToken
}
from
'
vscode
'
;
import
*
as
cp
from
'
child_process
'
;
declare
module
GitExtension
{
export
interface
IExecResult
<
T
extends
string
|
Buffer
>
{
readonly
exitCode
:
number
;
readonly
stdout
:
T
;
readonly
stderr
:
string
;
}
export
interface
ExecResult
<
T
extends
string
|
Buffer
>
{
readonly
exitCode
:
number
;
readonly
stdout
:
T
;
readonly
stderr
:
string
;
}
export
interface
SpawnOptions
extends
cp
.
SpawnOptions
{
readonly
input
?:
string
;
readonly
encoding
?:
string
;
readonly
log
?:
boolean
;
readonly
cancellationToken
?:
CancellationToken
;
}
export
interface
SpawnOptions
extends
cp
.
SpawnOptions
{
readonly
input
?:
string
;
readonly
encoding
?:
string
;
readonly
log
?:
boolean
;
readonly
cancellationToken
?:
CancellationToken
;
}
export
interface
API
{
readonly
gitP
ath
:
string
;
readonly
repositories
:
Repository
[]
;
readonly
onDidOpenRepository
:
Event
<
Repository
>
;
readonly
onDidCloseRepository
:
Event
<
Repository
>
;
export
interface
Git
{
readonly
p
ath
:
string
;
exec
(
cwd
:
string
,
args
:
string
[],
options
?:
SpawnOptions
):
Promise
<
ExecResult
<
string
>>
;
spawn
(
cwd
:
string
,
args
:
string
[],
options
?:
SpawnOptions
):
cp
.
ChildProcess
;
}
exec
(
cwd
:
string
,
args
:
string
[],
options
?:
SpawnOptions
):
Promise
<
IExecResult
<
string
>>
;
spawn
(
cwd
:
string
,
args
:
string
[],
options
?:
SpawnOptions
):
cp
.
ChildProcess
;
}
export
interface
API
{
readonly
git
:
Git
;
readonly
repositories
:
Repository
[];
readonly
onDidOpenRepository
:
Event
<
Repository
>
;
readonly
onDidCloseRepository
:
Event
<
Repository
>
;
}
export
interface
InputBox
{
value
:
string
;
}
export
interface
InputBox
{
value
:
string
;
}
export
interface
Repository
{
readonly
rootUri
:
Uri
;
readonly
inputBox
:
InputBox
;
}
export
interface
Repository
{
readonly
rootUri
:
Uri
;
readonly
inputBox
:
InputBox
;
}
declare
module
GitExtension
{
}
export
interface
GitExtension
{
/**
...
...
@@ -50,14 +52,14 @@ export interface GitExtension {
* @param range Semver version range for API compatibility.
* @returns API instance
*/
getAPI
(
range
:
string
):
GitExtension
.
API
;
getAPI
(
range
:
string
):
API
;
/**
* Returns the collection of active repositories.
*
* @deprecated Use `API.repositories` instead.
*/
getRepositories
():
Promise
<
GitExtension
.
Repository
[]
>
;
getRepositories
():
Promise
<
Repository
[]
>
;
/**
* Returns the path to the current git executable.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录