Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5774cc9c
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,发现更多精彩内容 >>
提交
5774cc9c
编写于
1月 10, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
git: commit
上级
7529eebb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
54 addition
and
28 deletion
+54
-28
extensions/git/src/git.ts
extensions/git/src/git.ts
+4
-4
extensions/git/src/model.ts
extensions/git/src/model.ts
+46
-23
extensions/git/src/scmProvider.ts
extensions/git/src/scmProvider.ts
+4
-1
未找到文件。
extensions/git/src/git.ts
浏览文件 @
5774cc9c
...
...
@@ -533,18 +533,18 @@ export class Repository {
}
}
async
commit
(
message
:
string
,
all
:
boolean
,
amend
:
boolean
,
signoff
:
boolean
):
Promise
<
void
>
{
async
commit
(
message
:
string
,
opts
:
{
all
?:
boolean
,
amend
?:
boolean
,
signoff
?:
boolean
}
=
Object
.
create
(
null
)
):
Promise
<
void
>
{
const
args
=
[
'
commit
'
,
'
--quiet
'
,
'
--allow-empty-message
'
,
'
--file
'
,
'
-
'
];
if
(
all
)
{
if
(
opts
.
all
)
{
args
.
push
(
'
--all
'
);
}
if
(
amend
)
{
if
(
opts
.
amend
)
{
args
.
push
(
'
--amend
'
);
}
if
(
signoff
)
{
if
(
opts
.
signoff
)
{
args
.
push
(
'
--signoff
'
);
}
...
...
extensions/git/src/model.ts
浏览文件 @
5774cc9c
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
{
Uri
,
EventEmitter
,
Event
,
SCMResource
,
SCMResourceDecorations
,
SCMResourceGroup
}
from
'
vscode
'
;
import
{
Repository
,
IRef
,
IRemote
,
IFileStatus
}
from
'
./git
'
;
import
{
Repository
,
IRef
,
IRemote
}
from
'
./git
'
;
import
{
throttle
}
from
'
./util
'
;
import
{
decorate
,
debounce
}
from
'
core-decorators
'
;
import
*
as
path
from
'
path
'
;
...
...
@@ -124,20 +124,29 @@ export class ResourceGroup implements SCMResourceGroup {
}
export
class
MergeGroup
extends
ResourceGroup
{
static
readonly
ID
=
'
merge
'
;
constructor
(
resources
:
SCMResource
[])
{
super
(
'
merge
'
,
'
Merge Changes
'
,
resources
);
super
(
MergeGroup
.
ID
,
'
Merge Changes
'
,
resources
);
}
}
export
class
IndexGroup
extends
ResourceGroup
{
static
readonly
ID
=
'
index
'
;
constructor
(
resources
:
SCMResource
[])
{
super
(
'
index
'
,
'
Staged Changes
'
,
resources
);
super
(
IndexGroup
.
ID
,
'
Staged Changes
'
,
resources
);
}
}
export
class
WorkingTreeGroup
extends
ResourceGroup
{
static
readonly
ID
=
'
workingTree
'
;
constructor
(
resources
:
SCMResource
[])
{
super
(
'
workingTree
'
,
'
Changes
'
,
resources
);
super
(
WorkingTreeGroup
.
ID
,
'
Changes
'
,
resources
);
}
}
...
...
@@ -146,8 +155,30 @@ export class Model {
private
_onDidChange
=
new
EventEmitter
<
SCMResourceGroup
[]
>
();
readonly
onDidChange
:
Event
<
SCMResourceGroup
[]
>
=
this
.
_onDidChange
.
event
;
private
_resources
:
ResourceGroup
[]
=
[];
get
resources
():
ResourceGroup
[]
{
return
this
.
_resources
;
}
private
_mergeGroup
=
new
MergeGroup
([]);
get
mergeGroup
():
MergeGroup
{
return
this
.
_mergeGroup
;
}
private
_indexGroup
=
new
IndexGroup
([]);
get
indexGroup
():
IndexGroup
{
return
this
.
_indexGroup
;
}
private
_workingTreeGroup
=
new
WorkingTreeGroup
([]);
get
workingTreeGroup
():
WorkingTreeGroup
{
return
this
.
_workingTreeGroup
;
}
get
resources
():
ResourceGroup
[]
{
const
result
:
ResourceGroup
[]
=
[];
if
(
this
.
_mergeGroup
.
resources
.
length
>
0
)
{
result
.
push
(
this
.
_mergeGroup
);
}
if
(
this
.
_indexGroup
.
resources
.
length
>
0
)
{
result
.
push
(
this
.
_indexGroup
);
}
result
.
push
(
this
.
_workingTreeGroup
);
return
result
;
}
constructor
(
private
_repositoryRoot
:
string
,
private
repository
:
Repository
)
{
...
...
@@ -209,12 +240,7 @@ export class Model {
this
.
_HEAD
=
HEAD
;
this
.
_refs
=
refs
;
this
.
_remotes
=
remotes
;
this
.
_resources
=
this
.
getResources
(
status
);
this
.
_onDidChange
.
fire
(
this
.
_resources
);
}
private
getResources
(
status
:
IFileStatus
[]):
ResourceGroup
[]
{
const
index
:
Resource
[]
=
[];
const
workingTree
:
Resource
[]
=
[];
const
merge
:
Resource
[]
=
[];
...
...
@@ -250,19 +276,11 @@ export class Model {
}
});
const
resources
:
ResourceGroup
[]
=
[];
if
(
merge
.
length
>
0
)
{
resources
.
push
(
new
MergeGroup
(
merge
));
}
this
.
_mergeGroup
=
new
MergeGroup
(
merge
);
this
.
_indexGroup
=
new
IndexGroup
(
index
);
this
.
_workingTreeGroup
=
new
WorkingTreeGroup
(
workingTree
);
if
(
index
.
length
>
0
)
{
resources
.
push
(
new
IndexGroup
(
index
));
}
resources
.
push
(
new
WorkingTreeGroup
(
workingTree
));
return
resources
;
this
.
_onDidChange
.
fire
(
this
.
resources
);
}
async
stage
(...
resources
:
Resource
[]):
Promise
<
void
>
{
...
...
@@ -276,4 +294,9 @@ export class Model {
await
this
.
repository
.
revertFiles
(
'
HEAD
'
,
paths
);
await
this
.
updateNow
();
}
async
commit
(
message
:
string
,
opts
:
{
all
?:
boolean
,
amend
?:
boolean
,
signoff
?:
boolean
}
=
Object
.
create
(
null
)):
Promise
<
void
>
{
await
this
.
repository
.
commit
(
message
,
opts
);
await
this
.
updateNow
();
}
}
\ No newline at end of file
extensions/git/src/scmProvider.ts
浏览文件 @
5774cc9c
...
...
@@ -22,7 +22,10 @@ export class GitSCMProvider implements SCMProvider {
}
commit
(
message
:
string
):
void
{
console
.
log
(
'
commit
'
,
message
);
const
all
=
this
.
model
.
indexGroup
.
resources
.
length
===
0
;
this
.
model
.
commit
(
message
,
{
all
})
.
catch
(
err
=>
console
.
error
(
err
));
}
open
(
resource
:
Resource
):
Thenable
<
void
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录