Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e7a96243
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,发现更多精彩内容 >>
提交
e7a96243
编写于
3月 08, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
improve pull/push specificity
上级
c40385ad
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
32 deletion
+42
-32
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+6
-6
extensions/git/src/repository.ts
extensions/git/src/repository.ts
+36
-26
未找到文件。
extensions/git/src/commands.ts
浏览文件 @
e7a96243
...
...
@@ -1345,7 +1345,7 @@ export class CommandCenter {
return
;
}
await
repository
.
pull
(
repository
.
HEAD
&&
repository
.
HEAD
.
upstream
);
await
repository
.
pull
(
repository
.
HEAD
);
}
@
command
(
'
git.pullRebase
'
,
{
repository
:
true
})
...
...
@@ -1357,7 +1357,7 @@ export class CommandCenter {
return
;
}
await
repository
.
pullWithRebase
(
repository
.
HEAD
&&
repository
.
HEAD
.
upstream
);
await
repository
.
pullWithRebase
(
repository
.
HEAD
);
}
@
command
(
'
git.push
'
,
{
repository
:
true
})
...
...
@@ -1375,7 +1375,7 @@ export class CommandCenter {
}
try
{
await
repository
.
push
(
repository
.
HEAD
.
upstream
);
await
repository
.
push
(
repository
.
HEAD
);
}
catch
(
err
)
{
if
(
err
.
gitErrorCode
!==
GitErrorCodes
.
NoUpstreamBranch
)
{
throw
err
;
...
...
@@ -1456,9 +1456,9 @@ export class CommandCenter {
}
if
(
rebase
)
{
await
repository
.
syncRebase
(
HEAD
.
upstream
);
await
repository
.
syncRebase
(
HEAD
);
}
else
{
await
repository
.
sync
(
HEAD
.
upstream
);
await
repository
.
sync
(
HEAD
);
}
}
...
...
@@ -1476,7 +1476,7 @@ export class CommandCenter {
return
;
}
await
repository
.
sync
(
HEAD
.
upstream
);
await
repository
.
sync
(
HEAD
);
}));
}
...
...
extensions/git/src/repository.ts
浏览文件 @
e7a96243
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
{
commands
,
Uri
,
Command
,
EventEmitter
,
Event
,
scm
,
SourceControl
,
SourceControlInputBox
,
SourceControlResourceGroup
,
SourceControlResourceState
,
SourceControlResourceDecorations
,
SourceControlInputBoxValidation
,
Disposable
,
ProgressLocation
,
window
,
workspace
,
WorkspaceEdit
,
ThemeColor
,
DecorationData
,
Memento
,
SourceControlInputBoxValidationType
}
from
'
vscode
'
;
import
{
Repository
as
BaseRepository
,
Ref
,
Branch
,
Remote
,
Commit
,
GitErrorCodes
,
Stash
,
RefType
,
GitError
,
Submodule
,
DiffOptions
,
UpstreamRef
}
from
'
./git
'
;
import
{
Repository
as
BaseRepository
,
Ref
,
Branch
,
Remote
,
Commit
,
GitErrorCodes
,
Stash
,
RefType
,
GitError
,
Submodule
,
DiffOptions
}
from
'
./git
'
;
import
{
anyEvent
,
filterEvent
,
eventToPromise
,
dispose
,
find
,
isDescendant
,
IDisposable
,
onceEvent
,
EmptyDisposable
,
debounceEvent
}
from
'
./util
'
;
import
{
memoize
,
throttle
,
debounce
}
from
'
./decorators
'
;
import
{
toGitUri
}
from
'
./uri
'
;
...
...
@@ -728,26 +728,26 @@ export class Repository implements Disposable {
}
@
throttle
async
pullWithRebase
(
upstream
?:
UpstreamRef
):
Promise
<
void
>
{
async
pullWithRebase
(
head
:
Branch
|
undefined
):
Promise
<
void
>
{
let
remote
:
string
|
undefined
;
let
branch
:
string
|
undefined
;
if
(
upstream
)
{
remote
=
upstream
.
remote
;
branch
=
upstream
.
name
;
if
(
head
&&
head
.
name
&&
head
.
upstream
)
{
remote
=
head
.
upstream
.
remote
;
branch
=
`
${
head
.
upstream
.
name
}
`
;
}
await
this
.
run
(
Operation
.
Pull
,
()
=>
this
.
repository
.
pull
(
true
,
remote
,
branch
));
}
@
throttle
async
pull
(
upstream
?:
UpstreamRef
):
Promise
<
void
>
{
async
pull
(
head
:
Branch
|
undefined
):
Promise
<
void
>
{
let
remote
:
string
|
undefined
;
let
branch
:
string
|
undefined
;
if
(
upstream
)
{
remote
=
upstream
.
remote
;
branch
=
upstream
.
name
;
if
(
head
&&
head
.
name
&&
head
.
upstream
)
{
remote
=
head
.
upstream
.
remote
;
branch
=
`
${
head
.
upstream
.
name
}
`
;
}
await
this
.
run
(
Operation
.
Pull
,
()
=>
this
.
repository
.
pull
(
false
,
remote
,
branch
));
...
...
@@ -758,13 +758,13 @@ export class Repository implements Disposable {
}
@
throttle
async
push
(
upstream
?:
UpstreamRef
):
Promise
<
void
>
{
async
push
(
head
:
Branch
):
Promise
<
void
>
{
let
remote
:
string
|
undefined
;
let
branch
:
string
|
undefined
;
if
(
upstream
)
{
remote
=
upstream
.
remote
;
branch
=
upstream
.
name
;
if
(
head
&&
head
.
name
&&
head
.
upstream
)
{
remote
=
head
.
upstream
.
remote
;
branch
=
`
${
head
.
name
}
:
${
head
.
upstream
.
name
}
`
;
}
await
this
.
run
(
Operation
.
Push
,
()
=>
this
.
repository
.
push
(
remote
,
branch
));
...
...
@@ -778,28 +778,38 @@ export class Repository implements Disposable {
await
this
.
run
(
Operation
.
Push
,
()
=>
this
.
repository
.
push
(
remote
,
undefined
,
false
,
true
));
}
private
async
_sync
(
upstream
:
UpstreamRef
,
rebase
:
boolean
):
Promise
<
void
>
{
@
throttle
sync
(
head
:
Branch
):
Promise
<
void
>
{
return
this
.
_sync
(
head
,
false
);
}
@
throttle
async
syncRebase
(
head
:
Branch
):
Promise
<
void
>
{
return
this
.
_sync
(
head
,
true
);
}
private
async
_sync
(
head
:
Branch
,
rebase
:
boolean
):
Promise
<
void
>
{
let
remote
:
string
|
undefined
;
let
pullBranch
:
string
|
undefined
;
let
pushBranch
:
string
|
undefined
;
if
(
head
.
name
&&
head
.
upstream
)
{
remote
=
head
.
upstream
.
remote
;
pullBranch
=
`
${
head
.
upstream
.
name
}
`
;
pushBranch
=
`
${
head
.
name
}
:
${
head
.
upstream
.
name
}
`
;
}
await
this
.
run
(
Operation
.
Sync
,
async
()
=>
{
await
this
.
repository
.
pull
(
rebase
,
upstream
.
remote
,
upstream
.
name
);
await
this
.
repository
.
pull
(
rebase
,
remote
,
pullBranch
);
const
shouldPush
=
this
.
HEAD
&&
typeof
this
.
HEAD
.
ahead
===
'
number
'
?
this
.
HEAD
.
ahead
>
0
:
true
;
if
(
shouldPush
)
{
await
this
.
repository
.
push
(
upstream
.
remote
,
upstream
.
name
);
await
this
.
repository
.
push
(
remote
,
pushBranch
);
}
});
}
@
throttle
sync
(
upstream
:
UpstreamRef
):
Promise
<
void
>
{
return
this
.
_sync
(
upstream
,
false
);
}
@
throttle
async
syncRebase
(
upstream
:
UpstreamRef
):
Promise
<
void
>
{
return
this
.
_sync
(
upstream
,
true
);
}
async
show
(
ref
:
string
,
filePath
:
string
):
Promise
<
string
>
{
return
await
this
.
run
(
Operation
.
Show
,
async
()
=>
{
const
relativePath
=
path
.
relative
(
this
.
repository
.
root
,
filePath
).
replace
(
/
\\
/g
,
'
/
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录