Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
818fa5a5
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,发现更多精彩内容 >>
提交
818fa5a5
编写于
5月 01, 2017
作者:
R
Rokas Gečas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#10542 Ability to merge local git branches
上级
e7ff4c37
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
49 addition
and
4 deletion
+49
-4
extensions/git/package.json
extensions/git/package.json
+5
-0
extensions/git/package.nls.json
extensions/git/package.nls.json
+1
-0
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+32
-3
extensions/git/src/git.ts
extensions/git/src/git.ts
+5
-0
extensions/git/src/model.ts
extensions/git/src/model.ts
+6
-1
未找到文件。
extensions/git/package.json
浏览文件 @
818fa5a5
...
...
@@ -172,6 +172,11 @@
"title"
:
"%command.branch%"
,
"category"
:
"Git"
},
{
"command"
:
"git.merge"
,
"title"
:
"%command.merge%"
,
"category"
:
"Git"
},
{
"command"
:
"git.pull"
,
"title"
:
"%command.pull%"
,
...
...
extensions/git/package.nls.json
浏览文件 @
818fa5a5
...
...
@@ -21,6 +21,7 @@
"command.undoCommit"
:
"Undo Last Commit"
,
"command.checkout"
:
"Checkout to..."
,
"command.branch"
:
"Create Branch..."
,
"command.merge"
:
"Merge Branch..."
,
"command.pull"
:
"Pull"
,
"command.pullRebase"
:
"Pull (Rebase)"
,
"command.push"
:
"Push"
,
...
...
extensions/git/src/commands.ts
浏览文件 @
818fa5a5
...
...
@@ -17,15 +17,21 @@ import * as nls from 'vscode-nls';
const
localize
=
nls
.
loadMessageBundle
();
class
CheckoutItem
implements
QuickPickItem
{
class
CheckoutBasicItem
implements
QuickPickItem
{
get
label
():
string
{
return
this
.
ref
.
name
||
''
;
}
get
description
():
string
{
return
this
.
ref
.
name
||
''
;
}
constructor
(
protected
ref
:
Ref
)
{
}
}
class
CheckoutItem
extends
CheckoutBasicItem
{
protected
get
shortCommit
():
string
{
return
(
this
.
ref
.
commit
||
''
).
substr
(
0
,
8
);
}
protected
get
treeish
():
string
|
undefined
{
return
this
.
ref
.
name
;
}
get
label
():
string
{
return
this
.
ref
.
name
||
this
.
shortCommit
;
}
get
description
():
string
{
return
this
.
shortCommit
;
}
constructor
(
protected
ref
:
Ref
)
{
}
async
run
(
model
:
Model
):
Promise
<
void
>
{
const
ref
=
this
.
treeish
;
...
...
@@ -671,6 +677,29 @@ export class CommandCenter {
await
this
.
model
.
branch
(
name
);
}
@
command
(
'
git.merge
'
)
async
merge
():
Promise
<
void
>
{
const
config
=
workspace
.
getConfiguration
(
'
git
'
);
const
checkoutType
=
config
.
get
<
string
>
(
'
checkoutType
'
)
||
'
all
'
;
const
includeRemotes
=
checkoutType
===
'
all
'
||
checkoutType
===
'
remote
'
;
const
heads
=
this
.
model
.
refs
.
filter
(
ref
=>
ref
.
type
===
RefType
.
Head
)
.
map
(
ref
=>
new
CheckoutItem
(
ref
));
const
remoteHeads
=
(
includeRemotes
?
this
.
model
.
refs
.
filter
(
ref
=>
ref
.
type
===
RefType
.
RemoteHead
)
:
[])
.
map
(
ref
=>
new
CheckoutRemoteHeadItem
(
ref
));
const
picks
=
[...
heads
,
...
remoteHeads
];
const
placeHolder
=
'
Select a ref to checkout
'
;
const
choice
=
await
window
.
showQuickPick
<
CheckoutBasicItem
>
(
picks
,
{
placeHolder
});
if
(
!
choice
)
{
return
;
}
await
this
.
model
.
merge
(
choice
.
label
);
}
@
command
(
'
git.pull
'
)
async
pull
():
Promise
<
void
>
{
const
remotes
=
this
.
model
.
remotes
;
...
...
extensions/git/src/git.ts
浏览文件 @
818fa5a5
...
...
@@ -650,6 +650,11 @@ export class Repository {
await
this
.
run
(
args
);
}
async
merge
(
name
:
string
):
Promise
<
void
>
{
const
args
=
[
'
merge
'
,
name
];
await
this
.
run
(
args
);
}
async
clean
(
paths
:
string
[]):
Promise
<
void
>
{
const
pathsByGroup
=
groupBy
(
paths
,
p
=>
path
.
dirname
(
p
));
const
groups
=
Object
.
keys
(
pathsByGroup
).
map
(
k
=>
pathsByGroup
[
k
]);
...
...
extensions/git/src/model.ts
浏览文件 @
818fa5a5
...
...
@@ -211,7 +211,8 @@ export enum Operation {
Init
=
1
<<
12
,
Show
=
1
<<
13
,
Stage
=
1
<<
14
,
GetCommitTemplate
=
1
<<
15
GetCommitTemplate
=
1
<<
15
,
Merge
=
1
<<
16
}
// function getOperationName(operation: Operation): string {
...
...
@@ -454,6 +455,10 @@ export class Model implements Disposable {
await
this
.
run
(
Operation
.
Branch
,
()
=>
this
.
repository
.
branch
(
name
,
true
));
}
async
merge
(
name
:
string
):
Promise
<
void
>
{
await
this
.
run
(
Operation
.
Merge
,
()
=>
this
.
repository
.
merge
(
name
));
}
async
checkout
(
treeish
:
string
):
Promise
<
void
>
{
await
this
.
run
(
Operation
.
Checkout
,
()
=>
this
.
repository
.
checkout
(
treeish
,
[]));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录