Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
3d928bbb
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,发现更多精彩内容 >>
提交
3d928bbb
编写于
1月 04, 2019
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
auto fetch period
上级
32d22dba
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
16 addition
and
18 deletion
+16
-18
extensions/git/package.json
extensions/git/package.json
+1
-1
extensions/git/package.nls.json
extensions/git/package.nls.json
+1
-1
extensions/git/src/autofetch.ts
extensions/git/src/autofetch.ts
+14
-16
未找到文件。
extensions/git/package.json
浏览文件 @
3d928bbb
...
@@ -1028,7 +1028,7 @@
...
@@ -1028,7 +1028,7 @@
"type"
:
"number"
,
"type"
:
"number"
,
"scope"
:
"resource"
,
"scope"
:
"resource"
,
"description"
:
"%config.autofetchPeriod%"
,
"description"
:
"%config.autofetchPeriod%"
,
"default"
:
3
"default"
:
180
},
},
"git.branchValidationRegex"
:
{
"git.branchValidationRegex"
:
{
"type"
:
"string"
,
"type"
:
"string"
,
...
...
extensions/git/package.nls.json
浏览文件 @
3d928bbb
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
"config.autoRepositoryDetection.openEditors"
:
"Scan for parent folders of open files."
,
"config.autoRepositoryDetection.openEditors"
:
"Scan for parent folders of open files."
,
"config.autorefresh"
:
"Whether auto refreshing is enabled."
,
"config.autorefresh"
:
"Whether auto refreshing is enabled."
,
"config.autofetch"
:
"When enabled, commits will automatically be fetched from the default remote of the current Git repository."
,
"config.autofetch"
:
"When enabled, commits will automatically be fetched from the default remote of the current Git repository."
,
"config.autofetchPeriod"
:
"Duration in
minute
s between each automatic git fetch, when `git.autofetch` is enabled."
,
"config.autofetchPeriod"
:
"Duration in
second
s between each automatic git fetch, when `git.autofetch` is enabled."
,
"config.confirmSync"
:
"Confirm before synchronizing git repositories."
,
"config.confirmSync"
:
"Confirm before synchronizing git repositories."
,
"config.countBadge"
:
"Controls the git badge counter."
,
"config.countBadge"
:
"Controls the git badge counter."
,
"config.countBadge.all"
:
"Count all changes."
,
"config.countBadge.all"
:
"Count all changes."
,
...
...
extensions/git/src/autofetch.ts
浏览文件 @
3d928bbb
...
@@ -19,17 +19,13 @@ export class AutoFetcher {
...
@@ -19,17 +19,13 @@ export class AutoFetcher {
private
static
DidInformUser
=
'
autofetch.didInformUser
'
;
private
static
DidInformUser
=
'
autofetch.didInformUser
'
;
private
_onDidChange
=
new
EventEmitter
<
boolean
|
number
>
();
private
_onDidChange
=
new
EventEmitter
<
boolean
>
();
private
onDidChange
=
this
.
_onDidChange
.
event
;
private
onDidChange
=
this
.
_onDidChange
.
event
;
private
_enabled
:
boolean
=
false
;
private
_enabled
:
boolean
=
false
;
get
enabled
():
boolean
{
return
this
.
_enabled
;
}
get
enabled
():
boolean
{
return
this
.
_enabled
;
}
set
enabled
(
enabled
:
boolean
)
{
this
.
_enabled
=
enabled
;
this
.
_onDidChange
.
fire
(
enabled
);
}
set
enabled
(
enabled
:
boolean
)
{
this
.
_enabled
=
enabled
;
this
.
_onDidChange
.
fire
(
enabled
);
}
private
_timeout
:
number
=
workspace
.
getConfiguration
(
'
git
'
).
get
<
number
>
(
'
autofetchPeriod
'
,
3
)
*
60
*
1000
;
private
get
timeout
():
number
{
return
this
.
_timeout
;
}
private
set
timeout
(
minutes
:
number
)
{
this
.
_timeout
=
minutes
*
60
*
1000
;
this
.
_onDidChange
.
fire
(
minutes
);
}
private
disposables
:
Disposable
[]
=
[];
private
disposables
:
Disposable
[]
=
[];
constructor
(
private
repository
:
Repository
,
private
globalState
:
Memento
)
{
constructor
(
private
repository
:
Repository
,
private
globalState
:
Memento
)
{
...
@@ -73,19 +69,19 @@ export class AutoFetcher {
...
@@ -73,19 +69,19 @@ export class AutoFetcher {
private
onConfiguration
():
void
{
private
onConfiguration
():
void
{
const
gitConfig
=
workspace
.
getConfiguration
(
'
git
'
);
const
gitConfig
=
workspace
.
getConfiguration
(
'
git
'
);
const
minutes
=
gitConfig
.
get
<
number
>
(
'
autofetchPeriod
'
,
3
);
const
autofetch
=
gitConfig
.
get
<
boolean
>
(
'
autofetch
'
);
if
(
this
.
timeout
!==
minutes
)
{
this
.
timeout
=
minutes
;
}
if
(
this
.
enabled
!==
autofetch
)
{
if
(
gitConfig
.
get
<
boolean
>
(
'
autofetch
'
)
===
false
)
{
autofetch
?
this
.
enable
()
:
this
.
disable
();
this
.
disable
();
}
else
{
this
.
enable
();
}
}
}
}
enable
():
void
{
enable
():
void
{
if
(
this
.
enabled
)
{
return
;
}
this
.
enabled
=
true
;
this
.
enabled
=
true
;
this
.
run
();
this
.
run
();
}
}
...
@@ -114,9 +110,11 @@ export class AutoFetcher {
...
@@ -114,9 +110,11 @@ export class AutoFetcher {
return
;
return
;
}
}
const
timeout
=
new
Promise
(
c
=>
setTimeout
(
c
,
this
.
timeout
));
const
period
=
workspace
.
getConfiguration
(
'
git
'
).
get
<
number
>
(
'
autofetchPeriod
'
,
180
)
*
1000
;
const
onChanged
=
eventToPromise
(
filterEvent
(
this
.
onDidChange
,
()
=>
true
));
const
timeout
=
new
Promise
(
c
=>
setTimeout
(
c
,
period
));
await
Promise
.
race
([
timeout
,
onChanged
]);
const
whenDisabled
=
eventToPromise
(
filterEvent
(
this
.
onDidChange
,
enabled
=>
!
enabled
));
await
Promise
.
race
([
timeout
,
whenDisabled
]);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录