Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
39f33ae2
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,发现更多精彩内容 >>
提交
39f33ae2
编写于
5月 20, 2017
作者:
B
Bugra Cuhadaroglu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Git: Pull from specific branch
上级
a49a4268
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
63 addition
and
6 deletion
+63
-6
extensions/git/package.json
extensions/git/package.json
+14
-0
extensions/git/package.nls.json
extensions/git/package.nls.json
+1
-0
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+31
-0
extensions/git/src/git.ts
extensions/git/src/git.ts
+13
-2
extensions/git/src/model.ts
extensions/git/src/model.ts
+4
-4
未找到文件。
extensions/git/package.json
浏览文件 @
39f33ae2
...
@@ -187,6 +187,11 @@
...
@@ -187,6 +187,11 @@
"title"
:
"%command.pullRebase%"
,
"title"
:
"%command.pullRebase%"
,
"category"
:
"Git"
"category"
:
"Git"
},
},
{
"command"
:
"git.pullFromRemoteBranch"
,
"title"
:
"%command.pullFromRemoteBranch%"
,
"category"
:
"Git"
},
{
{
"command"
:
"git.push"
,
"command"
:
"git.push"
,
"title"
:
"%command.push%"
,
"title"
:
"%command.push%"
,
...
@@ -311,6 +316,10 @@
...
@@ -311,6 +316,10 @@
"command"
:
"git.pull"
,
"command"
:
"git.pull"
,
"when"
:
"config.git.enabled && scmProvider == git && gitState == idle"
"when"
:
"config.git.enabled && scmProvider == git && gitState == idle"
},
},
{
"command"
:
"git.pullFromRemoteBranch"
,
"when"
:
"config.git.enabled && scmProvider == git && gitState == idle"
},
{
{
"command"
:
"git.pullRebase"
,
"command"
:
"git.pullRebase"
,
"when"
:
"config.git.enabled && scmProvider == git && gitState == idle"
"when"
:
"config.git.enabled && scmProvider == git && gitState == idle"
...
@@ -367,6 +376,11 @@
...
@@ -367,6 +376,11 @@
"group"
:
"1_sync"
,
"group"
:
"1_sync"
,
"when"
:
"config.git.enabled && scmProvider == git && gitState == idle"
"when"
:
"config.git.enabled && scmProvider == git && gitState == idle"
},
},
{
"command"
:
"git.pullFromRemoteBranch"
,
"group"
:
"1_sync"
,
"when"
:
"config.git.enabled && scmProvider == git && gitState == idle"
},
{
{
"command"
:
"git.push"
,
"command"
:
"git.push"
,
"group"
:
"1_sync"
,
"group"
:
"1_sync"
,
...
...
extensions/git/package.nls.json
浏览文件 @
39f33ae2
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
"command.deleteBranch"
:
"Delete Branch..."
,
"command.deleteBranch"
:
"Delete Branch..."
,
"command.pull"
:
"Pull"
,
"command.pull"
:
"Pull"
,
"command.pullRebase"
:
"Pull (Rebase)"
,
"command.pullRebase"
:
"Pull (Rebase)"
,
"command.pullFromRemoteBranch"
:
"Pull From..."
,
"command.push"
:
"Push"
,
"command.push"
:
"Push"
,
"command.pushTo"
:
"Push to..."
,
"command.pushTo"
:
"Push to..."
,
"command.sync"
:
"Sync"
,
"command.sync"
:
"Sync"
,
...
...
extensions/git/src/commands.ts
浏览文件 @
39f33ae2
...
@@ -764,6 +764,37 @@ export class CommandCenter {
...
@@ -764,6 +764,37 @@ export class CommandCenter {
}
}
}
}
@
command
(
'
git.pullFromRemoteBranch
'
)
async
pullFrom
():
Promise
<
void
>
{
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
;
}
const
picks
=
remotes
.
map
(
r
=>
({
label
:
r
.
name
,
description
:
r
.
url
}));
const
placeHolder
=
localize
(
'
pick remote pull repo
'
,
"
Pick a remote to pull the branch from
"
);
const
pick
=
await
window
.
showQuickPick
(
picks
,
{
placeHolder
});
if
(
!
pick
)
{
return
;
}
const
branchName
=
await
window
.
showInputBox
({
placeHolder
:
localize
(
'
branch name
'
,
"
Branch name
"
),
prompt
:
localize
(
'
provide branch name
'
,
"
Please provide a branch name
"
),
ignoreFocusOut
:
true
});
if
(
!
branchName
)
{
return
;
}
this
.
model
.
pull
(
false
,
pick
.
label
,
branchName
);
}
@
command
(
'
git.pull
'
)
@
command
(
'
git.pull
'
)
async
pull
():
Promise
<
void
>
{
async
pull
():
Promise
<
void
>
{
const
remotes
=
this
.
model
.
remotes
;
const
remotes
=
this
.
model
.
remotes
;
...
...
extensions/git/src/git.ts
浏览文件 @
39f33ae2
...
@@ -270,7 +270,8 @@ export const GitErrorCodes = {
...
@@ -270,7 +270,8 @@ export const GitErrorCodes = {
CantAccessRemote
:
'
CantAccessRemote
'
,
CantAccessRemote
:
'
CantAccessRemote
'
,
RepositoryNotFound
:
'
RepositoryNotFound
'
,
RepositoryNotFound
:
'
RepositoryNotFound
'
,
RepositoryIsLocked
:
'
RepositoryIsLocked
'
,
RepositoryIsLocked
:
'
RepositoryIsLocked
'
,
BranchNotFullyMerged
:
'
BranchNotFullyMerged
'
BranchNotFullyMerged
:
'
BranchNotFullyMerged
'
,
NoRemoteReference
:
'
NoRemoteReference
'
};
};
function
getGitErrorCode
(
stderr
:
string
):
string
|
undefined
{
function
getGitErrorCode
(
stderr
:
string
):
string
|
undefined
{
...
@@ -290,6 +291,8 @@ function getGitErrorCode(stderr: string): string | undefined {
...
@@ -290,6 +291,8 @@ function getGitErrorCode(stderr: string): string | undefined {
return
GitErrorCodes
.
CantAccessRemote
;
return
GitErrorCodes
.
CantAccessRemote
;
}
else
if
(
/branch '.+' is not fully merged/
.
test
(
stderr
))
{
}
else
if
(
/branch '.+' is not fully merged/
.
test
(
stderr
))
{
return
GitErrorCodes
.
BranchNotFullyMerged
;
return
GitErrorCodes
.
BranchNotFullyMerged
;
}
else
if
(
/Couldn
\'
t find remote ref/
.
test
(
stderr
))
{
return
GitErrorCodes
.
NoRemoteReference
;
}
}
return
void
0
;
return
void
0
;
...
@@ -734,13 +737,21 @@ export class Repository {
...
@@ -734,13 +737,21 @@ export class Repository {
}
}
}
}
async
pull
(
rebase
?:
boolean
):
Promise
<
void
>
{
async
pull
(
rebase
?:
boolean
,
remote
?:
string
,
name
?:
string
):
Promise
<
void
>
{
const
args
=
[
'
pull
'
];
const
args
=
[
'
pull
'
];
if
(
rebase
)
{
if
(
rebase
)
{
args
.
push
(
'
-r
'
);
args
.
push
(
'
-r
'
);
}
}
if
(
remote
)
{
args
.
push
(
remote
);
}
if
(
name
)
{
args
.
push
(
name
);
}
try
{
try
{
await
this
.
run
(
args
);
await
this
.
run
(
args
);
}
catch
(
err
)
{
}
catch
(
err
)
{
...
...
extensions/git/src/model.ts
浏览文件 @
39f33ae2
...
@@ -480,13 +480,13 @@ export class Model implements Disposable {
...
@@ -480,13 +480,13 @@ export class Model implements Disposable {
}
}
@
throttle
@
throttle
async
pull
():
Promise
<
void
>
{
async
pull
WithRebase
():
Promise
<
void
>
{
await
this
.
run
(
Operation
.
Pull
,
()
=>
this
.
repository
.
pull
());
await
this
.
run
(
Operation
.
Pull
,
()
=>
this
.
repository
.
pull
(
true
));
}
}
@
throttle
@
throttle
async
pull
WithRebase
(
):
Promise
<
void
>
{
async
pull
(
rebase
?:
boolean
,
remote
?:
string
,
name
?:
string
):
Promise
<
void
>
{
await
this
.
run
(
Operation
.
Pull
,
()
=>
this
.
repository
.
pull
(
tru
e
));
await
this
.
run
(
Operation
.
Pull
,
()
=>
this
.
repository
.
pull
(
rebase
,
remote
,
nam
e
));
}
}
@
throttle
@
throttle
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录