Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
01e466ee
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,发现更多精彩内容 >>
提交
01e466ee
编写于
1月 11, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
git: publish command, statusbar
上级
4c3f63a3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
9 deletion
+32
-9
extensions/git/package.json
extensions/git/package.json
+5
-0
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+19
-4
extensions/git/src/model.ts
extensions/git/src/model.ts
+8
-3
extensions/git/src/statusbar.ts
extensions/git/src/statusbar.ts
+0
-2
未找到文件。
extensions/git/package.json
浏览文件 @
01e466ee
...
...
@@ -93,6 +93,11 @@
"light"
:
"resources/icons/light/clean.svg"
,
"dark"
:
"resources/icons/dark/clean.svg"
}
},
{
"command"
:
"git.publish"
,
"title"
:
"Publish"
,
"category"
:
"Git"
}
],
"menus"
:
{
...
...
extensions/git/src/commands.ts
浏览文件 @
01e466ee
...
...
@@ -90,7 +90,8 @@ class CommandCenter {
commands
.
registerCommand
(
'
git.unstageAll
'
,
this
.
unstageAll
,
this
),
commands
.
registerCommand
(
'
git.clean
'
,
this
.
clean
,
this
),
commands
.
registerCommand
(
'
git.cleanAll
'
,
this
.
cleanAll
,
this
),
commands
.
registerCommand
(
'
git.checkout
'
,
this
.
checkout
,
this
)
commands
.
registerCommand
(
'
git.checkout
'
,
this
.
checkout
,
this
),
commands
.
registerCommand
(
'
git.publish
'
,
this
.
publish
,
this
),
);
}
...
...
@@ -192,9 +193,9 @@ class CommandCenter {
const
remoteHeads
=
(
includeRemotes
?
this
.
model
.
refs
.
filter
(
ref
=>
ref
.
type
===
RefType
.
RemoteHead
)
:
[])
.
map
(
ref
=>
new
CheckoutRemoteHeadItem
(
ref
));
const
choice
=
await
window
.
showQuickPick
<
CheckoutItem
>
([...
heads
,
...
tags
,
...
remoteHeads
],
{
placeHolder
:
'
Select a ref to checkout
'
});
const
picks
=
[...
heads
,
...
tags
,
...
remoteHeads
];
const
placeHolder
=
'
Select a ref to checkout
'
;
const
choice
=
await
window
.
showQuickPick
<
CheckoutItem
>
(
picks
,
{
placeHolder
});
if
(
!
choice
)
{
return
;
...
...
@@ -203,6 +204,20 @@ class CommandCenter {
await
choice
.
run
(
this
.
model
);
}
@
decorate
(
catchErrors
)
async
publish
():
Promise
<
void
>
{
const
branchName
=
this
.
model
.
HEAD
&&
this
.
model
.
HEAD
.
name
||
''
;
const
picks
=
this
.
model
.
remotes
.
map
(
r
=>
r
.
name
);
const
placeHolder
=
`Pick a remote to publish the branch '
${
branchName
}
' to:`
;
const
choice
=
await
window
.
showQuickPick
(
picks
,
{
placeHolder
});
if
(
!
choice
)
{
return
;
}
await
this
.
model
.
push
(
choice
,
branchName
,
{
setUpstream
:
true
});
}
dispose
():
void
{
this
.
disposables
.
forEach
(
d
=>
d
.
dispose
());
}
...
...
extensions/git/src/model.ts
浏览文件 @
01e466ee
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
{
Uri
,
EventEmitter
,
Event
,
SCMResource
,
SCMResourceDecorations
,
SCMResourceGroup
}
from
'
vscode
'
;
import
{
Repository
,
IRef
,
IBranch
,
IRemote
}
from
'
./git
'
;
import
{
Repository
,
IRef
,
IBranch
,
IRemote
,
IPushOptions
}
from
'
./git
'
;
import
{
throttle
}
from
'
./util
'
;
import
{
decorate
}
from
'
core-decorators
'
;
import
*
as
path
from
'
path
'
;
...
...
@@ -193,12 +193,12 @@ export class Model {
return
this
.
_HEAD
;
}
private
_refs
:
IRef
[];
private
_refs
:
IRef
[]
=
[]
;
get
refs
():
IRef
[]
{
return
this
.
_refs
;
}
private
_remotes
:
IRemote
[];
private
_remotes
:
IRemote
[]
=
[]
;
get
remotes
():
IRemote
[]
{
return
this
.
_remotes
;
}
...
...
@@ -326,4 +326,9 @@ export class Model {
await
this
.
repository
.
checkout
(
treeish
,
[]);
await
this
.
update
();
}
async
push
(
remote
?:
string
,
name
?:
string
,
options
?:
IPushOptions
):
Promise
<
void
>
{
await
this
.
repository
.
push
(
remote
,
name
,
options
);
await
this
.
update
();
}
}
\ No newline at end of file
extensions/git/src/statusbar.ts
浏览文件 @
01e466ee
...
...
@@ -58,8 +58,6 @@ export class SyncStatusBar {
constructor
(
private
model
:
Model
)
{
this
.
raw
=
window
.
createStatusBarItem
(
StatusBarAlignment
.
Left
);
this
.
disposables
.
push
(
this
.
raw
);
model
.
onDidChange
(
this
.
update
,
this
,
this
.
disposables
);
this
.
update
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录