Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a1fd23d5
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,发现更多精彩内容 >>
提交
a1fd23d5
编写于
5月 10, 2018
作者:
P
Peng Lyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
show local branches for PR
上级
1dc35219
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
58 addition
and
2 deletion
+58
-2
extensions/git-extended/src/common/models/pullRequestModel.ts
...nsions/git-extended/src/common/models/pullRequestModel.ts
+2
-1
extensions/git-extended/src/common/models/repository.ts
extensions/git-extended/src/common/models/repository.ts
+12
-0
extensions/git-extended/src/common/pullRequestGitHelper.ts
extensions/git-extended/src/common/pullRequestGitHelper.ts
+21
-0
extensions/git-extended/src/common/treeItems.ts
extensions/git-extended/src/common/treeItems.ts
+3
-0
extensions/git-extended/src/prView/prProvider.ts
extensions/git-extended/src/prView/prProvider.ts
+20
-0
extensions/git-extended/src/review/reviewManager.ts
extensions/git-extended/src/review/reviewManager.ts
+0
-1
未找到文件。
extensions/git-extended/src/common/models/pullRequestModel.ts
浏览文件 @
a1fd23d5
...
...
@@ -14,7 +14,8 @@ export enum PRType {
ReviewedByMe
=
1
,
Mine
=
2
,
Mention
=
3
,
All
=
4
All
=
4
,
LocalPullRequest
=
5
}
export
enum
PullRequestStateEnum
{
...
...
extensions/git-extended/src/common/models/repository.ts
浏览文件 @
a1fd23d5
...
...
@@ -243,6 +243,18 @@ export class Repository {
}
}
async
getLocalBranches
():
Promise
<
string
[]
>
{
let
result
=
await
GitProcess
.
exec
([
'
branch
'
],
this
.
path
);
if
(
result
.
exitCode
!==
0
)
{
return
[];
}
return
result
.
stdout
.
trim
().
split
(
/
\r
|
\n
|
\r\n
/
).
map
(
branchName
=>
{
return
branchName
.
substr
(
2
);
});
}
async
getRefs
():
Promise
<
Ref
[]
>
{
const
result
=
await
GitProcess
.
exec
([
'
for-each-ref
'
,
'
--format
'
,
'
%(refname) %(objectname)
'
,
'
--sort
'
,
'
-committerdate
'
],
this
.
path
);
...
...
extensions/git-extended/src/common/pullRequestGitHelper.ts
浏览文件 @
a1fd23d5
...
...
@@ -200,8 +200,29 @@ export class PullRequestGitHelper {
return
repository
.
cloneUrl
&&
repository
.
cloneUrl
.
equals
(
pullRequest
.
head
.
repositoryCloneUrl
);
}
static
async
getPullRequestForBranch
(
repository
:
Repository
,
branchName
:
string
)
{
let
prConfigKey
=
`branch.
${
branchName
}
.
${
SettingGHfVSCPullRequest
}
`
;
let
info
=
await
repository
.
getConfig
(
prConfigKey
);
return
info
;
}
static
async
markBranchAsPullRequest
(
repository
:
Repository
,
pullRequest
:
PullRequestModel
,
branchName
:
string
)
{
let
prConfigKey
=
`branch.
${
branchName
}
.
${
SettingGHfVSCPullRequest
}
`
;
await
repository
.
setConfig
(
prConfigKey
,
PullRequestGitHelper
.
buildGHfVSConfigKeyValue
(
pullRequest
));
}
static
async
getLocalBranchesMarkedAsPullRequest
(
repository
:
Repository
)
{
let
branches
=
await
repository
.
getLocalBranches
();
let
ret
=
[];
for
(
let
i
=
0
;
i
<
branches
.
length
;
i
++
)
{
let
localInfo
=
await
PullRequestGitHelper
.
getPullRequestForBranch
(
repository
,
branches
[
i
]);
if
(
localInfo
)
{
ret
.
push
(
PullRequestGitHelper
.
parseGHfVSConfigKeyValue
(
localInfo
));
}
}
return
ret
;
}
}
\ No newline at end of file
extensions/git-extended/src/common/treeItems.ts
浏览文件 @
a1fd23d5
...
...
@@ -60,6 +60,9 @@ export class PRGroupTreeItem implements vscode.TreeItem {
case
PRType
.
Mine
:
this
.
label
=
'
Mine
'
;
break
;
case
PRType
.
LocalPullRequest
:
this
.
label
=
'
Local Pull Request Branches
'
;
break
;
default
:
break
;
}
...
...
extensions/git-extended/src/prView/prProvider.ts
浏览文件 @
a1fd23d5
...
...
@@ -78,6 +78,7 @@ export class PRProvider implements vscode.TreeDataProvider<PRGroupTreeItem | Pul
async
getChildren
(
element
?:
PRGroupTreeItem
|
PullRequestModel
|
PRGroupActionTreeItem
|
FileChangeTreeItem
):
Promise
<
(
PRGroupTreeItem
|
PullRequestModel
|
PRGroupActionTreeItem
|
FileChangeTreeItem
)[]
>
{
if
(
!
element
)
{
return
Promise
.
resolve
([
new
PRGroupTreeItem
(
PRType
.
LocalPullRequest
),
new
PRGroupTreeItem
(
PRType
.
RequestReview
),
new
PRGroupTreeItem
(
PRType
.
ReviewedByMe
),
new
PRGroupTreeItem
(
PRType
.
Mine
),
...
...
@@ -245,6 +246,25 @@ export class PRProvider implements vscode.TreeDataProvider<PRGroupTreeItem | Pul
}
async
getPRs
(
element
:
PRGroupTreeItem
):
Promise
<
PullRequestModel
[]
>
{
if
(
element
.
type
===
PRType
.
LocalPullRequest
)
{
let
infos
=
await
PullRequestGitHelper
.
getLocalBranchesMarkedAsPullRequest
(
this
.
repository
);
let
promises
=
infos
.
map
(
async
info
=>
{
let
owner
=
info
.
owner
;
let
prNumber
=
info
.
prNumber
;
let
githubRepo
=
this
.
repository
.
githubRepositories
.
find
(
repo
=>
repo
.
remote
.
owner
.
toLocaleLowerCase
()
===
owner
.
toLocaleLowerCase
());
if
(
!
githubRepo
)
{
return
Promise
.
resolve
([]);
}
return
await
githubRepo
.
getPullRequest
(
prNumber
);
});
return
Promise
.
all
(
promises
).
then
(
values
=>
{
return
_
.
flatten
(
values
);
});
}
let
promises
=
this
.
repository
.
githubRepositories
.
map
(
async
githubRepository
=>
{
let
remote
=
githubRepository
.
remote
.
remoteName
;
let
isRemoteForPR
=
await
PullRequestGitHelper
.
isRemoteCreatedForPullRequest
(
this
.
repository
,
remote
);
...
...
extensions/git-extended/src/review/reviewManager.ts
浏览文件 @
a1fd23d5
...
...
@@ -385,7 +385,6 @@ export class ReviewManager implements vscode.DecorationProvider {
}
}
return
{};
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录