Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ff8d4fee
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,发现更多精彩内容 >>
提交
ff8d4fee
编写于
8月 09, 2020
作者:
S
sneakyfish5.sneaky@gmail.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Git: Add cherryPick command
上级
6d913c4c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
35 addition
and
0 deletion
+35
-0
extensions/git/package.json
extensions/git/package.json
+9
-0
extensions/git/package.nls.json
extensions/git/package.nls.json
+1
-0
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+15
-0
extensions/git/src/git.ts
extensions/git/src/git.ts
+5
-0
extensions/git/src/repository.ts
extensions/git/src/repository.ts
+5
-0
未找到文件。
extensions/git/package.json
浏览文件 @
ff8d4fee
...
@@ -326,6 +326,11 @@
...
@@ -326,6 +326,11 @@
"title"
:
"%command.pushFollowTagsForce%"
,
"title"
:
"%command.pushFollowTagsForce%"
,
"category"
:
"Git"
"category"
:
"Git"
},
},
{
"command"
:
"git.cherryPick"
,
"title"
:
"%command.cherryPick%"
,
"category"
:
"Git"
},
{
{
"command"
:
"git.addRemote"
,
"command"
:
"git.addRemote"
,
"title"
:
"%command.addRemote%"
,
"title"
:
"%command.addRemote%"
,
...
@@ -673,6 +678,10 @@
...
@@ -673,6 +678,10 @@
"command"
:
"git.pushWithTagsForce"
,
"command"
:
"git.pushWithTagsForce"
,
"when"
:
"config.git.enabled && !git.missing && config.git.allowForcePush && gitOpenRepositoryCount != 0"
"when"
:
"config.git.enabled && !git.missing && config.git.allowForcePush && gitOpenRepositoryCount != 0"
},
},
{
"command"
:
"git.cherryPick"
,
"when"
:
"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"
},
{
{
"command"
:
"git.addRemote"
,
"command"
:
"git.addRemote"
,
"when"
:
"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"
"when"
:
"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"
...
...
extensions/git/package.nls.json
浏览文件 @
ff8d4fee
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
"command.pushToForce"
:
"Push to... (Force)"
,
"command.pushToForce"
:
"Push to... (Force)"
,
"command.pushFollowTags"
:
"Push (Follow Tags)"
,
"command.pushFollowTags"
:
"Push (Follow Tags)"
,
"command.pushFollowTagsForce"
:
"Push (Follow Tags, Force)"
,
"command.pushFollowTagsForce"
:
"Push (Follow Tags, Force)"
,
"command.cherryPick"
:
"Cherry Pick..."
,
"command.addRemote"
:
"Add Remote..."
,
"command.addRemote"
:
"Add Remote..."
,
"command.removeRemote"
:
"Remove Remote"
,
"command.removeRemote"
:
"Remove Remote"
,
"command.sync"
:
"Sync"
,
"command.sync"
:
"Sync"
,
...
...
extensions/git/src/commands.ts
浏览文件 @
ff8d4fee
...
@@ -2027,6 +2027,21 @@ export class CommandCenter {
...
@@ -2027,6 +2027,21 @@ export class CommandCenter {
await
this
.
_push
(
repository
,
{
pushType
:
PushType
.
PushFollowTags
,
forcePush
:
true
});
await
this
.
_push
(
repository
,
{
pushType
:
PushType
.
PushFollowTags
,
forcePush
:
true
});
}
}
@
command
(
'
git.cherryPick
'
,
{
repository
:
true
})
async
cherryPick
(
repository
:
Repository
):
Promise
<
void
>
{
const
inputCommitHash
=
await
window
.
showInputBox
({
placeHolder
:
localize
(
'
commit hash
'
,
"
Commit Hash
"
),
prompt
:
localize
(
'
provide commit hash
'
,
"
Please provide the commit hash
"
),
ignoreFocusOut
:
true
});
if
(
!
inputCommitHash
)
{
return
;
}
await
repository
.
cherryPick
(
inputCommitHash
);
}
@
command
(
'
git.pushTo
'
,
{
repository
:
true
})
@
command
(
'
git.pushTo
'
,
{
repository
:
true
})
async
pushTo
(
repository
:
Repository
):
Promise
<
void
>
{
async
pushTo
(
repository
:
Repository
):
Promise
<
void
>
{
await
this
.
_push
(
repository
,
{
pushType
:
PushType
.
PushTo
});
await
this
.
_push
(
repository
,
{
pushType
:
PushType
.
PushTo
});
...
...
extensions/git/src/git.ts
浏览文件 @
ff8d4fee
...
@@ -1635,6 +1635,11 @@ export class Repository {
...
@@ -1635,6 +1635,11 @@ export class Repository {
}
}
}
}
async cherryPick(commitHash: string): Promise<void> {
const args = ['cherry-pick', commitHash];
await this.run(args);
}
async blame(path: string): Promise<string> {
async blame(path: string): Promise<string> {
try {
try {
const args = ['blame', sanitizePath(path)];
const args = ['blame', sanitizePath(path)];
...
...
extensions/git/src/repository.ts
浏览文件 @
ff8d4fee
...
@@ -294,6 +294,7 @@ export const enum Operation {
...
@@ -294,6 +294,7 @@ export const enum Operation {
Fetch
=
'
Fetch
'
,
Fetch
=
'
Fetch
'
,
Pull
=
'
Pull
'
,
Pull
=
'
Pull
'
,
Push
=
'
Push
'
,
Push
=
'
Push
'
,
CherryPick
=
'
CherryPick
'
,
Sync
=
'
Sync
'
,
Sync
=
'
Sync
'
,
Show
=
'
Show
'
,
Show
=
'
Show
'
,
Stage
=
'
Stage
'
,
Stage
=
'
Stage
'
,
...
@@ -1195,6 +1196,10 @@ export class Repository implements Disposable {
...
@@ -1195,6 +1196,10 @@ export class Repository implements Disposable {
await
this
.
run
(
Operation
.
Push
,
()
=>
this
.
_push
(
remote
,
undefined
,
false
,
true
,
forcePushMode
));
await
this
.
run
(
Operation
.
Push
,
()
=>
this
.
_push
(
remote
,
undefined
,
false
,
true
,
forcePushMode
));
}
}
async
cherryPick
(
commitHash
:
string
):
Promise
<
void
>
{
await
this
.
run
(
Operation
.
CherryPick
,
()
=>
this
.
repository
.
cherryPick
(
commitHash
));
}
async
blame
(
path
:
string
):
Promise
<
string
>
{
async
blame
(
path
:
string
):
Promise
<
string
>
{
return
await
this
.
run
(
Operation
.
Blame
,
()
=>
this
.
repository
.
blame
(
path
));
return
await
this
.
run
(
Operation
.
Blame
,
()
=>
this
.
repository
.
blame
(
path
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录