Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
206d3424
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
206d3424
编写于
6月 13, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use more compact git ipc status messages
上级
6b75d7a1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
101 addition
and
46 deletion
+101
-46
src/vs/workbench/parts/git/common/gitIpc.ts
src/vs/workbench/parts/git/common/gitIpc.ts
+101
-46
未找到文件。
src/vs/workbench/parts/git/common/gitIpc.ts
浏览文件 @
206d3424
...
...
@@ -8,27 +8,82 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IChannel
,
eventToCall
,
eventFromCall
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
Event
from
'
vs/base/common/event
'
;
import
{
IRawGitService
,
RawServiceState
,
IRawStatus
,
IPushOptions
,
IAskpassService
,
ICredentials
}
from
'
./git
'
;
import
{
IRawGitService
,
RawServiceState
,
IRawStatus
,
IPushOptions
,
IAskpassService
,
ICredentials
,
ServiceState
,
IRawFileStatus
,
IBranch
,
RefType
,
IRef
,
IRemote
}
from
'
./git
'
;
type
ISerializer
<
A
,
B
>
=
{
to
(
a
:
A
):
B
;
from
(
b
:
B
):
A
;
};
export
type
IPCRawFileStatus
=
[
string
,
string
,
string
,
string
,
string
];
const
RawFileStatusSerializer
:
ISerializer
<
IRawFileStatus
,
IPCRawFileStatus
>
=
{
to
:
a
=>
[
a
.
x
,
a
.
y
,
a
.
path
,
a
.
mimetype
,
a
.
rename
],
from
:
b
=>
({
x
:
b
[
0
],
y
:
b
[
1
],
path
:
b
[
2
],
mimetype
:
b
[
3
],
rename
:
b
[
4
]
})
};
export
type
IPCBranch
=
[
string
,
string
,
RefType
,
string
,
string
,
number
,
number
];
const
BranchSerializer
:
ISerializer
<
IBranch
,
IPCBranch
>
=
{
to
:
a
=>
[
a
.
name
,
a
.
commit
,
a
.
type
,
a
.
remote
,
a
.
upstream
,
a
.
ahead
,
a
.
behind
],
from
:
b
=>
({
name
:
b
[
0
],
commit
:
b
[
1
],
type
:
b
[
2
],
remote
:
b
[
3
],
upstream
:
b
[
4
],
ahead
:
b
[
5
],
behind
:
b
[
6
]
})
};
export
type
IPCRef
=
[
string
,
string
,
RefType
,
string
];
const
RefSerializer
:
ISerializer
<
IRef
,
IPCRef
>
=
{
to
:
a
=>
[
a
.
name
,
a
.
commit
,
a
.
type
,
a
.
remote
],
from
:
b
=>
({
name
:
b
[
0
],
commit
:
b
[
1
],
type
:
b
[
2
],
remote
:
b
[
3
]
})
};
export
type
IPCRemote
=
[
string
,
string
];
const
RemoteSerializer
:
ISerializer
<
IRemote
,
IPCRemote
>
=
{
to
:
a
=>
[
a
.
name
,
a
.
url
],
from
:
b
=>
({
name
:
b
[
0
],
url
:
b
[
1
]
})
};
export
type
IPCRawStatus
=
[
string
,
ServiceState
,
IPCRawFileStatus
[],
IPCBranch
,
IPCRef
[],
IPCRemote
[]
];
const
RawStatusSerializer
:
ISerializer
<
IRawStatus
,
IPCRawStatus
>
=
{
to
:
a
=>
!
a
?
null
:
[
a
.
repositoryRoot
,
a
.
state
,
a
.
status
.
map
(
RawFileStatusSerializer
.
to
),
BranchSerializer
.
to
(
a
.
HEAD
),
a
.
refs
.
map
(
RefSerializer
.
to
),
a
.
remotes
.
map
(
RemoteSerializer
.
to
)
],
from
:
b
=>
!
b
?
null
:
{
repositoryRoot
:
b
[
0
],
state
:
b
[
1
],
status
:
b
[
2
].
map
(
RawFileStatusSerializer
.
from
),
HEAD
:
BranchSerializer
.
from
(
b
[
3
]),
refs
:
b
[
4
].
map
(
RefSerializer
.
from
),
remotes
:
b
[
5
].
map
(
RemoteSerializer
.
from
)
}
};
export
interface
IGitChannel
extends
IChannel
{
call
(
command
:
'
getVersion
'
):
TPromise
<
string
>
;
call
(
command
:
'
serviceState
'
):
TPromise
<
RawServiceState
>
;
call
(
command
:
'
statusCount
'
):
TPromise
<
number
>
;
call
(
command
:
'
status
'
):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
init
'
):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
add
'
,
filesPaths
?:
string
[]):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
stage
'
,
args
:
[
string
,
string
]):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
branch
'
,
args
:
[
string
,
boolean
]):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
checkout
'
,
args
:
[
string
,
string
[]]):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
clean
'
,
filePaths
:
string
[]):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
undo
'
):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
reset
'
,
args
:
[
string
,
boolean
]):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
revertFiles
'
,
args
:
[
string
,
string
[]]):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
fetch
'
):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
pull
'
,
rebase
?:
boolean
):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
push
'
,
args
:
[
string
,
string
,
IPushOptions
]):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
sync
'
):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
commit
'
,
args
:
[
string
,
boolean
,
boolean
]):
TPromise
<
IRawStatus
>
;
call
(
command
:
'
status
'
):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
init
'
):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
add
'
,
filesPaths
?:
string
[]):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
stage
'
,
args
:
[
string
,
string
]):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
branch
'
,
args
:
[
string
,
boolean
]):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
checkout
'
,
args
:
[
string
,
string
[]]):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
clean
'
,
filePaths
:
string
[]):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
undo
'
):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
reset
'
,
args
:
[
string
,
boolean
]):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
revertFiles
'
,
args
:
[
string
,
string
[]]):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
fetch
'
):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
pull
'
,
rebase
?:
boolean
):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
push
'
,
args
:
[
string
,
string
,
IPushOptions
]):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
sync
'
):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
commit
'
,
args
:
[
string
,
boolean
,
boolean
]):
TPromise
<
I
PC
RawStatus
>
;
call
(
command
:
'
detectMimetypes
'
,
args
:
[
string
,
string
]):
TPromise
<
string
[]
>
;
call
(
command
:
'
show
'
,
args
:
[
string
,
string
]):
TPromise
<
string
>
;
call
(
command
:
'
onOutput
'
):
TPromise
<
void
>
;
...
...
@@ -44,21 +99,21 @@ export class GitChannel implements IGitChannel {
case
'
getVersion
'
:
return
this
.
service
.
then
(
s
=>
s
.
getVersion
());
case
'
serviceState
'
:
return
this
.
service
.
then
(
s
=>
s
.
serviceState
());
case
'
statusCount
'
:
return
this
.
service
.
then
(
s
=>
s
.
statusCount
());
case
'
status
'
:
return
this
.
service
.
then
(
s
=>
s
.
status
());
case
'
init
'
:
return
this
.
service
.
then
(
s
=>
s
.
init
());
case
'
add
'
:
return
this
.
service
.
then
(
s
=>
s
.
add
(
args
));
case
'
stage
'
:
return
this
.
service
.
then
(
s
=>
s
.
stage
(
args
[
0
],
args
[
1
]));
case
'
branch
'
:
return
this
.
service
.
then
(
s
=>
s
.
branch
(
args
[
0
],
args
[
1
]));
case
'
checkout
'
:
return
this
.
service
.
then
(
s
=>
s
.
checkout
(
args
[
0
],
args
[
1
]));
case
'
clean
'
:
return
this
.
service
.
then
(
s
=>
s
.
clean
(
args
));
case
'
undo
'
:
return
this
.
service
.
then
(
s
=>
s
.
undo
());
case
'
reset
'
:
return
this
.
service
.
then
(
s
=>
s
.
reset
(
args
[
0
],
args
[
1
]));
case
'
revertFiles
'
:
return
this
.
service
.
then
(
s
=>
s
.
revertFiles
(
args
[
0
],
args
[
1
]));
case
'
fetch
'
:
return
this
.
service
.
then
(
s
=>
s
.
fetch
());
case
'
pull
'
:
return
this
.
service
.
then
(
s
=>
s
.
pull
(
args
));
case
'
push
'
:
return
this
.
service
.
then
(
s
=>
s
.
push
(
args
[
0
],
args
[
1
],
args
[
2
]));
case
'
sync
'
:
return
this
.
service
.
then
(
s
=>
s
.
sync
());
case
'
commit
'
:
return
this
.
service
.
then
(
s
=>
s
.
commit
(
args
[
0
],
args
[
1
],
args
[
2
]));
case
'
status
'
:
return
this
.
service
.
then
(
s
=>
s
.
status
())
.
then
(
RawStatusSerializer
.
to
)
;
case
'
init
'
:
return
this
.
service
.
then
(
s
=>
s
.
init
())
.
then
(
RawStatusSerializer
.
to
)
;
case
'
add
'
:
return
this
.
service
.
then
(
s
=>
s
.
add
(
args
))
.
then
(
RawStatusSerializer
.
to
)
;
case
'
stage
'
:
return
this
.
service
.
then
(
s
=>
s
.
stage
(
args
[
0
],
args
[
1
]))
.
then
(
RawStatusSerializer
.
to
)
;
case
'
branch
'
:
return
this
.
service
.
then
(
s
=>
s
.
branch
(
args
[
0
],
args
[
1
]))
.
then
(
RawStatusSerializer
.
to
)
;
case
'
checkout
'
:
return
this
.
service
.
then
(
s
=>
s
.
checkout
(
args
[
0
],
args
[
1
]))
.
then
(
RawStatusSerializer
.
to
)
;
case
'
clean
'
:
return
this
.
service
.
then
(
s
=>
s
.
clean
(
args
))
.
then
(
RawStatusSerializer
.
to
)
;
case
'
undo
'
:
return
this
.
service
.
then
(
s
=>
s
.
undo
())
.
then
(
RawStatusSerializer
.
to
)
;
case
'
reset
'
:
return
this
.
service
.
then
(
s
=>
s
.
reset
(
args
[
0
],
args
[
1
]))
.
then
(
RawStatusSerializer
.
to
)
;
case
'
revertFiles
'
:
return
this
.
service
.
then
(
s
=>
s
.
revertFiles
(
args
[
0
],
args
[
1
]))
.
then
(
RawStatusSerializer
.
to
)
;
case
'
fetch
'
:
return
this
.
service
.
then
(
s
=>
s
.
fetch
())
.
then
(
RawStatusSerializer
.
to
)
;
case
'
pull
'
:
return
this
.
service
.
then
(
s
=>
s
.
pull
(
args
))
.
then
(
RawStatusSerializer
.
to
)
;
case
'
push
'
:
return
this
.
service
.
then
(
s
=>
s
.
push
(
args
[
0
],
args
[
1
],
args
[
2
]))
.
then
(
RawStatusSerializer
.
to
)
;
case
'
sync
'
:
return
this
.
service
.
then
(
s
=>
s
.
sync
())
.
then
(
RawStatusSerializer
.
to
)
;
case
'
commit
'
:
return
this
.
service
.
then
(
s
=>
s
.
commit
(
args
[
0
],
args
[
1
],
args
[
2
]))
.
then
(
RawStatusSerializer
.
to
)
;
case
'
detectMimetypes
'
:
return
this
.
service
.
then
(
s
=>
s
.
detectMimetypes
(
args
[
0
],
args
[
1
]));
case
'
show
'
:
return
this
.
service
.
then
(
s
=>
s
.
show
(
args
[
0
],
args
[
1
]));
case
'
onOutput
'
:
return
this
.
service
.
then
(
s
=>
eventToCall
(
s
.
onOutput
));
...
...
@@ -96,63 +151,63 @@ export class GitChannelClient implements IRawGitService {
}
status
():
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
status
'
);
return
this
.
channel
.
call
(
'
status
'
)
.
then
(
RawStatusSerializer
.
from
)
;
}
init
():
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
init
'
);
return
this
.
channel
.
call
(
'
init
'
)
.
then
(
RawStatusSerializer
.
from
)
;
}
add
(
filesPaths
?:
string
[]):
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
add
'
,
filesPaths
);
return
this
.
channel
.
call
(
'
add
'
,
filesPaths
)
.
then
(
RawStatusSerializer
.
from
)
;
}
stage
(
filePath
:
string
,
content
:
string
):
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
stage
'
,
[
filePath
,
content
]);
return
this
.
channel
.
call
(
'
stage
'
,
[
filePath
,
content
])
.
then
(
RawStatusSerializer
.
from
)
;
}
branch
(
name
:
string
,
checkout
?:
boolean
):
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
branch
'
,
[
name
,
checkout
]);
return
this
.
channel
.
call
(
'
branch
'
,
[
name
,
checkout
])
.
then
(
RawStatusSerializer
.
from
)
;
}
checkout
(
treeish
?:
string
,
filePaths
?:
string
[]):
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
checkout
'
,
[
treeish
,
filePaths
]);
return
this
.
channel
.
call
(
'
checkout
'
,
[
treeish
,
filePaths
])
.
then
(
RawStatusSerializer
.
from
)
;
}
clean
(
filePaths
:
string
[]):
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
clean
'
,
filePaths
);
return
this
.
channel
.
call
(
'
clean
'
,
filePaths
)
.
then
(
RawStatusSerializer
.
from
)
;
}
undo
():
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
undo
'
);
return
this
.
channel
.
call
(
'
undo
'
)
.
then
(
RawStatusSerializer
.
from
)
;
}
reset
(
treeish
:
string
,
hard
?:
boolean
):
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
reset
'
,
[
treeish
,
hard
]);
return
this
.
channel
.
call
(
'
reset
'
,
[
treeish
,
hard
])
.
then
(
RawStatusSerializer
.
from
)
;
}
revertFiles
(
treeish
:
string
,
filePaths
?:
string
[]):
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
revertFiles
'
,
[
treeish
,
filePaths
]);
return
this
.
channel
.
call
(
'
revertFiles
'
,
[
treeish
,
filePaths
])
.
then
(
RawStatusSerializer
.
from
)
;
}
fetch
():
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
fetch
'
);
return
this
.
channel
.
call
(
'
fetch
'
)
.
then
(
RawStatusSerializer
.
from
)
;
}
pull
(
rebase
?:
boolean
):
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
pull
'
,
rebase
);
return
this
.
channel
.
call
(
'
pull
'
,
rebase
)
.
then
(
RawStatusSerializer
.
from
)
;
}
push
(
remote
?:
string
,
name
?:
string
,
options
?:
IPushOptions
):
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
push
'
,
[
remote
,
name
,
options
]);
return
this
.
channel
.
call
(
'
push
'
,
[
remote
,
name
,
options
])
.
then
(
RawStatusSerializer
.
from
)
;
}
sync
():
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
sync
'
);
return
this
.
channel
.
call
(
'
sync
'
)
.
then
(
RawStatusSerializer
.
from
)
;
}
commit
(
message
:
string
,
amend
?:
boolean
,
stage
?:
boolean
):
TPromise
<
IRawStatus
>
{
return
this
.
channel
.
call
(
'
commit
'
,
[
message
,
amend
,
stage
]);
return
this
.
channel
.
call
(
'
commit
'
,
[
message
,
amend
,
stage
])
.
then
(
RawStatusSerializer
.
from
)
;
}
detectMimetypes
(
path
:
string
,
treeish
?:
string
):
TPromise
<
string
[]
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录