Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
96010725
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
96010725
编写于
10月 10, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
confirm git sync by default
上级
46df55c9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
5 deletion
+36
-5
src/vs/workbench/parts/git/browser/gitActions.ts
src/vs/workbench/parts/git/browser/gitActions.ts
+35
-4
src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts
.../workbench/parts/git/browser/gitWorkbenchContributions.ts
+1
-1
未找到文件。
src/vs/workbench/parts/git/browser/gitActions.ts
浏览文件 @
96010725
...
...
@@ -29,6 +29,8 @@ import { IGitService, IFileStatus, Status, StatusType, ServiceState, IModel, IBr
import
{
IQuickOpenService
}
from
'
vs/workbench/services/quickopen/common/quickOpenService
'
;
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
URI
from
'
vs/base/common/uri
'
;
import
{
IWindowService
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
import
{
IConfigurationEditingService
,
ConfigurationTarget
}
from
'
vs/workbench/services/configuration/common/configurationEditing
'
;
function
flatten
(
context
?:
any
,
preferFocus
=
false
):
IFileStatus
[]
{
if
(
!
context
)
{
...
...
@@ -1090,7 +1092,9 @@ export class SyncAction extends GitAction {
constructor
(
id
:
string
,
label
:
string
,
@
IGitService
gitService
:
IGitService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IConfigurationEditingService
private
configurationEditingService
:
IConfigurationEditingService
,
@
IWindowService
private
windowService
:
IWindowService
)
{
super
(
id
,
label
,
'
git-action sync
'
,
gitService
);
}
...
...
@@ -1119,12 +1123,39 @@ export class SyncAction extends GitAction {
return
TPromise
.
as
(
null
);
}
const
config
=
this
.
configurationService
.
getConfiguration
<
IGitConfiguration
>
(
'
git
'
)
;
const
shouldPrompt
=
this
.
configurationService
.
getConfiguration
<
IGitConfiguration
>
(
'
git
'
).
confirmSync
;
if
(
config
.
confirmSync
&&
!
window
.
confirm
(
nls
.
localize
(
'
sureSync
'
,
"
Are you sure you want to synchronize your git repository?
"
)))
{
return
TPromise
.
as
(
null
);
if
(
!
shouldPrompt
)
{
return
this
.
sync
();
}
const
model
=
this
.
gitService
.
getModel
();
const
HEAD
=
model
.
getHEAD
();
const
window
=
this
.
windowService
.
getWindow
();
const
choice
=
window
.
showMessageBox
({
title
:
SyncAction
.
LABEL
,
message
:
nls
.
localize
(
'
sync is unpredictable
'
,
"
This action will push and pull commits to and from '{0}'.
"
,
HEAD
.
upstream
),
type
:
'
warning
'
,
detail
:
nls
.
localize
(
'
do you want to continue
'
,
"
Are you sure you want to continue?
"
),
buttons
:
[
nls
.
localize
(
'
ok
'
,
"
OK
"
),
nls
.
localize
(
'
cancel
'
,
"
Cancel
"
),
nls
.
localize
(
'
never again
'
,
"
OK, Never Show Again
"
)],
noLink
:
true
,
cancelId
:
1
});
switch
(
choice
)
{
case
0
:
return
this
.
sync
();
case
1
:
return
TPromise
.
as
(
null
);
case
2
:
return
this
.
configurationEditingService
.
writeConfiguration
(
ConfigurationTarget
.
USER
,
{
key
:
'
git.confirmSync
'
,
value
:
false
})
.
then
(()
=>
this
.
sync
());
default
:
return
TPromise
.
as
(
null
);
}
}
private
sync
():
TPromise
<
any
>
{
return
this
.
gitService
.
sync
().
then
(
null
,
(
err
)
=>
{
if
(
err
.
gitErrorCode
===
GitErrorCodes
.
AuthenticationFailed
)
{
return
Promise
.
wrapError
(
errors
.
create
(
nls
.
localize
(
'
authFailed
'
,
"
Authentication failed on the git remote.
"
)));
...
...
src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts
浏览文件 @
96010725
...
...
@@ -556,7 +556,7 @@ export function registerContributions(): void {
'
git.confirmSync
'
:
{
type
:
'
boolean
'
,
description
:
nls
.
localize
(
'
confirmSync
'
,
"
Confirm before synchronizing git repositories.
"
),
default
:
fals
e
default
:
tru
e
},
'
git.countBadge
'
:
{
type
:
'
string
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录