Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c693ba29
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,发现更多精彩内容 >>
提交
c693ba29
编写于
6月 04, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
git:
💄
no_push feature
上级
fb29dd07
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
28 addition
and
22 deletion
+28
-22
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+5
-1
extensions/git/src/git.ts
extensions/git/src/git.ts
+16
-19
extensions/git/src/repository.ts
extensions/git/src/repository.ts
+7
-2
未找到文件。
extensions/git/src/commands.ts
浏览文件 @
c693ba29
...
...
@@ -1456,8 +1456,12 @@ export class CommandCenter {
return
;
}
const
remoteName
=
HEAD
.
remote
||
HEAD
.
upstream
.
remote
;
const
remote
=
repository
.
remotes
.
find
(
r
=>
r
.
name
===
remoteName
);
const
isReadonly
=
remote
&&
remote
.
isReadOnly
;
const
config
=
workspace
.
getConfiguration
(
'
git
'
);
const
shouldPrompt
=
config
.
get
<
boolean
>
(
'
confirmSync
'
)
===
true
;
const
shouldPrompt
=
!
isReadonly
&&
config
.
get
<
boolean
>
(
'
confirmSync
'
)
===
true
;
if
(
shouldPrompt
)
{
const
message
=
localize
(
'
sync is unpredictable
'
,
"
This action will push and pull commits to and from '{0}/{1}'.
"
,
HEAD
.
upstream
.
remote
,
HEAD
.
upstream
.
name
);
...
...
extensions/git/src/git.ts
浏览文件 @
c693ba29
...
...
@@ -35,7 +35,7 @@ export interface Remote {
name
:
string
;
fetchUrl
?:
string
;
pushUrl
?:
string
;
canPush
:
boolean
;
isReadOnly
:
boolean
;
}
export
interface
Stash
{
...
...
@@ -1228,34 +1228,31 @@ export class Repository {
async
getRemotes
():
Promise
<
Remote
[]
>
{
const
result
=
await
this
.
run
([
'
remote
'
,
'
--verbose
'
]);
const
remotes
:
Remote
[]
=
[];
const
lines
=
result
.
stdout
.
trim
().
split
(
'
\n
'
).
filter
(
l
=>
!!
l
);
const
remotes
:
Remote
[]
=
[];
for
(
const
line
of
lines
)
{
const
parts
=
line
.
split
(
/
\s
/
);
let
remote
=
remotes
.
find
(
r
=>
r
.
name
===
parts
[
0
]);
const
[
name
,
url
,
type
]
=
parts
;
let
remote
=
remotes
.
find
(
r
=>
r
.
name
===
name
);
if
(
!
remote
)
{
remote
=
{
name
:
parts
[
0
],
canPush
:
tru
e
};
remote
=
{
name
,
isReadOnly
:
fals
e
};
remotes
.
push
(
remote
);
}
switch
(
parts
[
2
])
{
case
'
(fetch)
'
:
{
remote
.
fetchUrl
=
parts
[
1
];
break
;
}
case
'
(push)
'
:
{
remote
.
pushUrl
=
parts
[
1
];
break
;
}
default
:
{
remote
.
fetchUrl
=
parts
[
1
];
remote
.
pushUrl
=
parts
[
1
];
break
;
}
if
(
/fetch/i
.
test
(
type
))
{
remote
.
fetchUrl
=
url
;
}
else
if
(
/push/i
.
test
(
type
))
{
remote
.
pushUrl
=
url
;
}
else
{
remote
.
fetchUrl
=
url
;
remote
.
pushUrl
=
url
;
}
// https://github.com/Microsoft/vscode/issues/45271
remote
.
canPush
=
remote
.
pushUrl
!==
undefined
&&
remote
.
pushUrl
!
==
'
no_push
'
;
remote
.
isReadOnly
=
remote
.
pushUrl
===
undefined
||
remote
.
pushUrl
=
==
'
no_push
'
;
}
return
remotes
;
...
...
extensions/git/src/repository.ts
浏览文件 @
c693ba29
...
...
@@ -803,7 +803,12 @@ export class Repository implements Disposable {
await
this
.
repository
.
pull
(
rebase
,
remoteName
,
pullBranch
);
const
remote
=
this
.
remotes
.
find
(
r
=>
r
.
name
===
remoteName
);
const
shouldPush
=
this
.
HEAD
&&
(
typeof
this
.
HEAD
.
ahead
===
'
number
'
?
this
.
HEAD
.
ahead
>
0
:
true
)
&&
(
!
remote
||
remote
.
canPush
);
if
(
remote
&&
remote
.
isReadOnly
)
{
return
;
}
const
shouldPush
=
this
.
HEAD
&&
(
typeof
this
.
HEAD
.
ahead
===
'
number
'
?
this
.
HEAD
.
ahead
>
0
:
true
);
if
(
shouldPush
)
{
await
this
.
repository
.
push
(
remoteName
,
pushBranch
);
...
...
@@ -1154,7 +1159,7 @@ export class Repository implements Disposable {
const
remoteName
=
this
.
HEAD
&&
this
.
HEAD
.
remote
||
this
.
HEAD
.
upstream
.
remote
;
const
remote
=
this
.
remotes
.
find
(
r
=>
r
.
name
===
remoteName
);
if
(
remote
&&
!
remote
.
canPush
)
{
if
(
remote
&&
remote
.
isReadOnly
)
{
return
`
${
this
.
HEAD
.
behind
}
↓`
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录