Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
65786afc
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,发现更多精彩内容 >>
提交
65786afc
编写于
11月 25, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
strictNullChecks for git extension
上级
15ed59b2
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
30 addition
and
58 deletion
+30
-58
extensions/git/src/git.ts
extensions/git/src/git.ts
+20
-21
extensions/git/src/main.ts
extensions/git/src/main.ts
+7
-6
extensions/git/src/util.ts
extensions/git/src/util.ts
+0
-29
extensions/git/tsconfig.json
extensions/git/tsconfig.json
+2
-1
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+1
-1
未找到文件。
extensions/git/src/git.ts
浏览文件 @
65786afc
...
...
@@ -96,23 +96,22 @@ function findGitHubGitWin32(): Promise<IGit> {
function
findGitWin32
():
Promise
<
IGit
>
{
return
findSystemGitWin32
(
process
.
env
[
'
ProgramW6432
'
])
.
then
(
null
,
()
=>
findSystemGitWin32
(
process
.
env
[
'
ProgramFiles(x86)
'
]))
.
then
(
null
,
()
=>
findSystemGitWin32
(
process
.
env
[
'
ProgramFiles
'
]))
.
then
(
null
,
()
=>
findSpecificGit
(
'
git
'
))
.
then
(
null
,
()
=>
findGitHubGitWin32
());
.
then
(
void
0
,
()
=>
findSystemGitWin32
(
process
.
env
[
'
ProgramFiles(x86)
'
]))
.
then
(
void
0
,
()
=>
findSystemGitWin32
(
process
.
env
[
'
ProgramFiles
'
]))
.
then
(
void
0
,
()
=>
findSpecificGit
(
'
git
'
))
.
then
(
void
0
,
()
=>
findGitHubGitWin32
());
}
export
function
findGit
(
hint
:
string
):
Promise
<
IGit
>
{
export
function
findGit
(
hint
:
string
|
undefined
):
Promise
<
IGit
>
{
var
first
=
hint
?
findSpecificGit
(
hint
)
:
Promise
.
reject
<
IGit
>
(
null
);
return
first
.
then
(
null
,
()
=>
{
return
first
.
then
(
void
0
,
()
=>
{
switch
(
process
.
platform
)
{
case
'
darwin
'
:
return
findGitDarwin
();
case
'
win32
'
:
return
findGitWin32
();
default
:
return
findSpecificGit
(
'
git
'
);
}
});
}
...
...
@@ -178,28 +177,28 @@ export interface IGitErrorData {
export
class
GitError
{
error
:
Error
;
error
?
:
Error
;
message
:
string
;
stdout
:
string
;
stderr
:
string
;
exitCode
:
number
;
gitErrorCode
:
string
;
gitCommand
:
string
;
stdout
?
:
string
;
stderr
?
:
string
;
exitCode
?
:
number
;
gitErrorCode
?
:
string
;
gitCommand
?
:
string
;
constructor
(
data
:
IGitErrorData
)
{
if
(
data
.
error
)
{
this
.
error
=
data
.
error
;
this
.
message
=
data
.
error
.
message
;
}
else
{
this
.
error
=
null
;
this
.
error
=
void
0
;
}
this
.
message
=
this
.
message
||
data
.
message
||
'
Git error
'
;
this
.
stdout
=
data
.
stdout
||
null
;
this
.
stderr
=
data
.
stderr
||
null
;
this
.
exitCode
=
data
.
exitCode
||
null
;
this
.
gitErrorCode
=
data
.
gitErrorCode
||
null
;
this
.
gitCommand
=
data
.
gitCommand
||
null
;
this
.
stdout
=
data
.
stdout
;
this
.
stderr
=
data
.
stderr
;
this
.
exitCode
=
data
.
exitCode
;
this
.
gitErrorCode
=
data
.
gitErrorCode
;
this
.
gitCommand
=
data
.
gitCommand
;
}
toString
():
string
{
...
...
@@ -209,7 +208,7 @@ export class GitError {
gitCommand
:
this
.
gitCommand
,
stdout
:
this
.
stdout
,
stderr
:
this
.
stderr
},
null
,
2
);
},
[]
,
2
);
if
(
this
.
error
)
{
result
+=
(
<
any
>
this
.
error
).
stack
;
...
...
@@ -289,7 +288,7 @@ export class Git {
return
exec
(
child
).
then
(
result
=>
{
if
(
result
.
exitCode
)
{
let
gitErrorCode
:
string
=
null
;
let
gitErrorCode
:
string
|
undefined
=
void
0
;
if
(
/Authentication failed/
.
test
(
result
.
stderr
))
{
gitErrorCode
=
GitErrorCodes
.
AuthenticationFailed
;
...
...
extensions/git/src/main.ts
浏览文件 @
65786afc
...
...
@@ -15,11 +15,11 @@ export function log(...args: any[]): void {
class
GitSCMProvider
{
resourceGroups
=
[];
onDidChangeResourceGroup
=
null
;
onDidChangeResourceGroup
:
any
=
null
;
getOriginalResource
(
uri
:
Uri
):
Uri
{
getOriginalResource
(
uri
:
Uri
):
Uri
|
undefined
{
if
(
uri
.
scheme
!==
'
file
'
)
{
return
null
;
return
void
0
;
}
return
uri
.
with
({
scheme
:
'
git-index
'
});
...
...
@@ -27,10 +27,11 @@ class GitSCMProvider {
}
export
function
activate
(
context
:
ExtensionContext
):
any
{
if
(
!
workspace
)
{
if
(
!
workspace
.
rootPath
)
{
return
;
}
const
rootPath
=
workspace
.
rootPath
;
const
pathHint
=
workspace
.
getConfiguration
(
'
git
'
).
get
<
string
>
(
'
path
'
);
findGit
(
pathHint
).
then
(
info
=>
{
...
...
@@ -42,9 +43,9 @@ export function activate(context: ExtensionContext): any {
const
contentProvider
=
workspace
.
registerTextDocumentContentProvider
(
'
git-index
'
,
{
provideTextDocumentContent
:
uri
=>
{
const
relativePath
=
path
.
relative
(
workspace
.
rootPath
,
uri
.
fsPath
);
const
relativePath
=
path
.
relative
(
rootPath
,
uri
.
fsPath
);
return
git
.
exec
(
workspace
.
rootPath
,
[
'
show
'
,
`HEAD:
${
relativePath
}
`
]).
then
(
result
=>
{
return
git
.
exec
(
rootPath
,
[
'
show
'
,
`HEAD:
${
relativePath
}
`
]).
then
(
result
=>
{
if
(
result
.
exitCode
!==
0
)
{
return
null
;
}
...
...
extensions/git/src/util.ts
浏览文件 @
65786afc
...
...
@@ -35,32 +35,3 @@ export function filterEvent<T>(event: Event<T>, filter: (e: T) => boolean): Even
export
function
anyEvent
<
T
>
(...
events
:
Event
<
T
>
[]):
Event
<
T
>
{
return
(
listener
,
thisArgs
=
null
,
disposables
?)
=>
combinedDisposable
(
events
.
map
(
event
=>
event
(
i
=>
listener
.
call
(
thisArgs
,
i
),
disposables
)));
}
interface
IListener
<
T
>
{
(
e
:
T
):
any
;
}
export
class
Emitter
<
T
>
{
private
listeners
:
IListener
<
T
>
[];
get
event
():
Event
<
T
>
{
return
(
listener
:
IListener
<
T
>
,
thisArgs
=
null
,
disposables
?:
IDisposable
[])
=>
{
const
_listener
=
thisArgs
?
listener
.
bind
(
thisArgs
)
:
listener
;
this
.
listeners
.
push
(
_listener
);
const
dispose
=
()
=>
{
this
.
listeners
=
this
.
listeners
.
filter
(
l
=>
l
!==
_listener
);
};
const
result
=
{
dispose
};
if
(
disposables
)
{
disposables
.
push
(
result
);
}
return
result
;
};
}
fire
(
e
:
T
=
null
):
void
{
}
}
\ No newline at end of file
extensions/git/tsconfig.json
浏览文件 @
65786afc
...
...
@@ -3,7 +3,8 @@
"noLib"
:
true
,
"target"
:
"es5"
,
"module"
:
"commonjs"
,
"outDir"
:
"./out"
"outDir"
:
"./out"
,
"strictNullChecks"
:
true
},
"exclude"
:
[
"node_modules"
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
65786afc
...
...
@@ -100,7 +100,7 @@ declare module 'vscode' {
dragCommand
?:
string
;
resourceGroups
:
SCMResourceGroup
[];
onDidChangeResourceGroup
:
Event
<
SCMResourceGroup
>
;
getOriginalResource
?(
uri
:
Uri
,
token
:
CancellationToken
):
Uri
|
Thenable
<
Uri
>
;
getOriginalResource
?(
uri
:
Uri
,
token
:
CancellationToken
):
ProviderResult
<
Uri
>
;
}
export
namespace
scm
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录