Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a0b3d09a
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,发现更多精彩内容 >>
提交
a0b3d09a
编写于
2月 08, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
git: pull, push, sync commands
上级
8929a0e7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
75 addition
and
20 deletion
+75
-20
extensions/git/package.json
extensions/git/package.json
+4
-4
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+53
-4
extensions/git/src/model.ts
extensions/git/src/model.ts
+18
-12
未找到文件。
extensions/git/package.json
浏览文件 @
a0b3d09a
...
...
@@ -202,22 +202,22 @@
{
"command"
:
"git.pull"
,
"group"
:
"1_sync"
,
"when"
:
"scmProvider ==
none
"
"when"
:
"scmProvider ==
git
"
},
{
"command"
:
"git.pullRebase"
,
"group"
:
"1_sync"
,
"when"
:
"scmProvider ==
none
"
"when"
:
"scmProvider ==
git
"
},
{
"command"
:
"git.push"
,
"group"
:
"1_sync"
,
"when"
:
"scmProvider ==
none
"
"when"
:
"scmProvider ==
git
"
},
{
"command"
:
"git.pushTo"
,
"group"
:
"1_sync"
,
"when"
:
"scmProvider ==
none
"
"when"
:
"scmProvider ==
git
"
},
{
"command"
:
"git.publish"
,
...
...
extensions/git/src/commands.ts
浏览文件 @
a0b3d09a
...
...
@@ -449,25 +449,67 @@ export class CommandCenter {
@
CommandCenter
.
Command
(
'
git.pull
'
)
@
CommandCenter
.
CatchErrors
async
pull
():
Promise
<
void
>
{
await
Promise
.
reject
(
'
not implemented
'
);
const
remotes
=
this
.
model
.
remotes
;
if
(
remotes
.
length
===
0
)
{
window
.
showWarningMessage
(
localize
(
'
no remotes to pull
'
,
"
Your repository has no remotes configured to pull from.
"
));
return
;
}
await
this
.
model
.
pull
();
}
@
CommandCenter
.
Command
(
'
git.pullRebase
'
)
@
CommandCenter
.
CatchErrors
async
pullRebase
():
Promise
<
void
>
{
await
Promise
.
reject
(
'
not implemented
'
);
const
remotes
=
this
.
model
.
remotes
;
if
(
remotes
.
length
===
0
)
{
window
.
showWarningMessage
(
localize
(
'
no remotes to pull
'
,
"
Your repository has no remotes configured to pull from.
"
));
return
;
}
await
this
.
model
.
pull
(
true
);
}
@
CommandCenter
.
Command
(
'
git.push
'
)
@
CommandCenter
.
CatchErrors
async
push
():
Promise
<
void
>
{
await
Promise
.
reject
(
'
not implemented
'
);
const
remotes
=
this
.
model
.
remotes
;
if
(
remotes
.
length
===
0
)
{
window
.
showWarningMessage
(
localize
(
'
no remotes to push
'
,
"
Your repository has no remotes configured to push to.
"
));
return
;
}
await
this
.
model
.
push
();
}
@
CommandCenter
.
Command
(
'
git.pushTo
'
)
@
CommandCenter
.
CatchErrors
async
pushTo
():
Promise
<
void
>
{
await
Promise
.
reject
(
'
not implemented
'
);
const
remotes
=
this
.
model
.
remotes
;
if
(
remotes
.
length
===
0
)
{
window
.
showWarningMessage
(
localize
(
'
no remotes to push
'
,
"
Your repository has no remotes configured to push to.
"
));
return
;
}
if
(
!
this
.
model
.
HEAD
||
!
this
.
model
.
HEAD
.
name
)
{
window
.
showWarningMessage
(
localize
(
'
nobranch
'
,
"
Please check out a branch to push to a remote.
"
));
return
;
}
const
branchName
=
this
.
model
.
HEAD
.
name
;
const
picks
=
remotes
.
map
(
r
=>
({
label
:
r
.
name
,
description
:
r
.
url
}));
const
placeHolder
=
localize
(
'
pick remote
'
,
"
Pick a remote to publish the branch '{0}' to:
"
,
branchName
);
const
pick
=
await
window
.
showQuickPick
(
picks
,
{
placeHolder
});
if
(
!
pick
)
{
return
;
}
this
.
model
.
push
(
pick
.
label
,
branchName
);
}
@
CommandCenter
.
Command
(
'
git.sync
'
)
...
...
@@ -501,6 +543,13 @@ export class CommandCenter {
@
CommandCenter
.
Command
(
'
git.publish
'
)
@
CommandCenter
.
CatchErrors
async
publish
():
Promise
<
void
>
{
const
remotes
=
this
.
model
.
remotes
;
if
(
remotes
.
length
===
0
)
{
window
.
showWarningMessage
(
localize
(
'
no remotes to publish
'
,
"
Your repository has no remotes configured to publish to.
"
));
return
;
}
const
branchName
=
this
.
model
.
HEAD
&&
this
.
model
.
HEAD
.
name
||
''
;
const
picks
=
this
.
model
.
remotes
.
map
(
r
=>
r
.
name
);
const
placeHolder
=
localize
(
'
pick remote
'
,
"
Pick a remote to publish the branch '{0}' to:
"
,
branchName
);
...
...
extensions/git/src/model.ts
浏览文件 @
a0b3d09a
...
...
@@ -154,16 +154,17 @@ export class WorkingTreeGroup extends ResourceGroup {
}
export
enum
Operation
{
Status
=
0o1
,
Stage
=
0o2
,
Unstage
=
0o4
,
Commit
=
0o10
,
Clean
=
0o20
,
Branch
=
0o40
,
Checkout
=
0o100
,
Fetch
=
0o200
,
Sync
=
0o400
,
Push
=
0o1000
Status
=
1
<<
0
,
Stage
=
1
<<
1
,
Unstage
=
1
<<
2
,
Commit
=
1
<<
3
,
Clean
=
1
<<
4
,
Branch
=
1
<<
5
,
Checkout
=
1
<<
6
,
Fetch
=
1
<<
7
,
Pull
=
1
<<
8
,
Push
=
1
<<
9
,
Sync
=
1
<<
10
}
export
interface
Operations
{
...
...
@@ -357,8 +358,8 @@ export class Model {
}
@
throttle
async
sync
(
):
Promise
<
void
>
{
await
this
.
run
(
Operation
.
Sync
,
()
=>
this
.
repository
.
sync
(
));
async
pull
(
rebase
?:
boolean
):
Promise
<
void
>
{
await
this
.
run
(
Operation
.
Pull
,
()
=>
this
.
repository
.
pull
(
rebase
));
}
@
throttle
...
...
@@ -366,6 +367,11 @@ export class Model {
await
this
.
run
(
Operation
.
Push
,
()
=>
this
.
repository
.
push
(
remote
,
name
,
options
));
}
@
throttle
async
sync
():
Promise
<
void
>
{
await
this
.
run
(
Operation
.
Sync
,
()
=>
this
.
repository
.
sync
());
}
private
async
run
(
operation
:
Operation
,
fn
:
()
=>
Promise
<
void
>
=
()
=>
Promise
.
resolve
()):
Promise
<
void
>
{
return
window
.
withScmProgress
(
async
()
=>
{
this
.
_operations
=
this
.
_operations
.
start
(
operation
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录