Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1d8ceaa1
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,发现更多精彩内容 >>
提交
1d8ceaa1
编写于
8月 12, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
git lib: getCommit
上级
7ddbab54
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
36 addition
and
42 deletion
+36
-42
src/vs/workbench/parts/git/browser/gitActions.ts
src/vs/workbench/parts/git/browser/gitActions.ts
+3
-1
src/vs/workbench/parts/git/browser/gitServices.ts
src/vs/workbench/parts/git/browser/gitServices.ts
+2
-3
src/vs/workbench/parts/git/common/git.ts
src/vs/workbench/parts/git/common/git.ts
+7
-3
src/vs/workbench/parts/git/common/gitIpc.ts
src/vs/workbench/parts/git/common/gitIpc.ts
+5
-6
src/vs/workbench/parts/git/common/noopGitService.ts
src/vs/workbench/parts/git/common/noopGitService.ts
+2
-3
src/vs/workbench/parts/git/node/git.lib.ts
src/vs/workbench/parts/git/node/git.lib.ts
+12
-21
src/vs/workbench/parts/git/node/rawGitService.ts
src/vs/workbench/parts/git/node/rawGitService.ts
+5
-5
未找到文件。
src/vs/workbench/parts/git/browser/gitActions.ts
浏览文件 @
1d8ceaa1
...
...
@@ -1125,7 +1125,9 @@ export class UndoLastCommitAction extends GitAction {
}
public
run
():
Promise
{
return
this
.
gitService
.
getLog
({
prevCount
:
1
,
format
:
'
%B
'
}).
then
(
prevCommitMsg
=>
this
.
storageService
.
store
(
'
prevCommitMsg
'
,
prevCommitMsg
)).
then
(
_
=>
this
.
gitService
.
reset
(
'
HEAD~
'
));
return
this
.
gitService
.
getCommit
(
'
HEAD
'
)
.
then
(
commit
=>
this
.
storageService
.
store
(
'
prevCommitMsg
'
,
commit
.
message
))
.
then
(
_
=>
this
.
gitService
.
reset
(
'
HEAD~
'
));
}
}
...
...
src/vs/workbench/parts/git/browser/gitServices.ts
浏览文件 @
1d8ceaa1
...
...
@@ -38,7 +38,6 @@ import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage'
import
Event
from
'
vs/base/common/event
'
;
import
{
domEvent
}
from
'
vs/base/browser/event
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
ILogOptions
}
from
'
vs/workbench/parts/git/node/git.lib
'
;
function
toReadablePath
(
path
:
string
):
string
{
if
(
!
platform
.
isWindows
)
{
...
...
@@ -696,8 +695,8 @@ export class GitService extends ee.EventEmitter
return
this
.
raw
.
getCommitTemplate
();
}
public
get
Log
(
options
?:
ILogOptions
):
winjs
.
Promise
{
return
this
.
raw
.
get
Log
(
options
);
public
get
Commit
(
ref
:
string
):
winjs
.
TPromise
<
git
.
ICommit
>
{
return
this
.
raw
.
get
Commit
(
ref
);
}
public
detectMimetypes
(
path
:
string
,
treeish
:
string
=
'
~
'
):
winjs
.
Promise
{
...
...
src/vs/workbench/parts/git/common/git.ts
浏览文件 @
1d8ceaa1
...
...
@@ -10,7 +10,6 @@ import { IEventEmitter } from 'vs/base/common/eventEmitter';
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
Event
from
'
vs/base/common/event
'
;
import
{
ILogOptions
}
from
'
vs/workbench/parts/git/node/git.lib
'
;
// Model raw interfaces
...
...
@@ -55,6 +54,11 @@ export interface IRawStatus {
remotes
:
IRemote
[];
}
export
interface
ICommit
{
hash
:
string
;
message
:
string
;
}
// Model enums
export
enum
StatusType
{
...
...
@@ -288,7 +292,7 @@ export interface IRawGitService {
detectMimetypes
(
path
:
string
,
treeish
?:
string
):
TPromise
<
string
[]
>
;
show
(
path
:
string
,
treeish
?:
string
):
TPromise
<
string
>
;
getCommitTemplate
():
TPromise
<
string
>
;
get
Log
(
options
?:
ILogOptions
):
TPromise
<
string
>
;
get
Commit
(
ref
:
string
):
TPromise
<
ICommit
>
;
}
export
const
GIT_SERVICE_ID
=
'
gitService
'
;
...
...
@@ -326,7 +330,7 @@ export interface IGitService extends IEventEmitter {
getRunningOperations
():
IGitOperation
[];
getAutoFetcher
():
IAutoFetcher
;
getCommitTemplate
():
TPromise
<
string
>
;
get
Log
(
options
?:
ILogOptions
):
TPromise
<
string
>
;
get
Commit
(
ref
:
string
):
TPromise
<
ICommit
>
;
}
export
interface
IAskpassService
{
...
...
src/vs/workbench/parts/git/common/gitIpc.ts
浏览文件 @
1d8ceaa1
...
...
@@ -9,8 +9,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
IChannel
,
eventToCall
,
eventFromCall
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
Event
from
'
vs/base/common/event
'
;
import
{
IRawGitService
,
RawServiceState
,
IRawStatus
,
IPushOptions
,
IAskpassService
,
ICredentials
,
ServiceState
,
IRawFileStatus
,
IBranch
,
RefType
,
IRef
,
IRemote
}
from
'
./git
'
;
import
{
ILogOptions
}
from
'
vs/workbench/parts/git/node/git.lib
'
;
ServiceState
,
IRawFileStatus
,
IBranch
,
RefType
,
IRef
,
IRemote
,
ICommit
}
from
'
./git
'
;
type
ISerializer
<
A
,
B
>
=
{
to
(
a
:
A
):
B
;
from
(
b
:
B
):
A
;
};
...
...
@@ -89,7 +88,7 @@ export interface IGitChannel extends IChannel {
call
(
command
:
'
show
'
,
args
:
[
string
,
string
]):
TPromise
<
string
>
;
call
(
command
:
'
onOutput
'
):
TPromise
<
void
>
;
call
(
command
:
'
getCommitTemplate
'
):
TPromise
<
string
>
;
call
(
command
:
'
get
Log
'
,
options
?:
ILogOptions
):
TPromise
<
string
>
;
call
(
command
:
'
get
Commit
'
,
ref
:
string
):
TPromise
<
ICommit
>
;
call
(
command
:
string
,
args
:
any
):
TPromise
<
any
>
;
}
...
...
@@ -121,7 +120,7 @@ export class GitChannel implements IGitChannel {
case
'
show
'
:
return
this
.
service
.
then
(
s
=>
s
.
show
(
args
[
0
],
args
[
1
]));
case
'
onOutput
'
:
return
this
.
service
.
then
(
s
=>
eventToCall
(
s
.
onOutput
));
case
'
getCommitTemplate
'
:
return
this
.
service
.
then
(
s
=>
s
.
getCommitTemplate
());
case
'
get
Log
'
:
return
this
.
service
.
then
(
s
=>
s
.
getLog
(
args
));
case
'
get
Commit
'
:
return
this
.
service
.
then
(
s
=>
s
.
getCommit
(
args
));
}
}
}
...
...
@@ -227,8 +226,8 @@ export class GitChannelClient implements IRawGitService {
return
this
.
channel
.
call
(
'
getCommitTemplate
'
);
}
get
Log
(
options
?:
ILogOptions
):
TPromise
<
string
>
{
return
this
.
channel
.
call
(
'
get
Log
'
,
options
);
get
Commit
(
ref
:
string
):
TPromise
<
ICommit
>
{
return
this
.
channel
.
call
(
'
get
Commit
'
,
ref
);
}
}
...
...
src/vs/workbench/parts/git/common/noopGitService.ts
浏览文件 @
1d8ceaa1
...
...
@@ -4,10 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
IRawGitService
,
IRawStatus
,
ServiceState
,
RawServiceState
}
from
'
vs/workbench/parts/git/common/git
'
;
import
{
IRawGitService
,
IRawStatus
,
ServiceState
,
RawServiceState
,
ICommit
}
from
'
vs/workbench/parts/git/common/git
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ILogOptions
}
from
'
vs/workbench/parts/git/node/git.lib
'
;
export
class
NoOpGitService
implements
IRawGitService
{
...
...
@@ -107,7 +106,7 @@ export class NoOpGitService implements IRawGitService {
return
TPromise
.
as
(
null
);
}
get
Log
(
options
?:
ILogOptions
):
TPromise
<
string
>
{
get
Commit
(
ref
:
string
):
TPromise
<
ICommit
>
{
return
TPromise
.
as
(
null
);
}
}
\ No newline at end of file
src/vs/workbench/parts/git/node/git.lib.ts
浏览文件 @
1d8ceaa1
...
...
@@ -119,18 +119,6 @@ export class GitError {
}
}
export
interface
ILogOptions
{
/**
* @example `git log -1 --format=%B` to get the last commit log, message only
*/
prevCount
?:
number
;
/**
* @example format: "%B" translates to `git log --format=%B` to extract only the message
*/
format
?:
string
;
}
export
interface
IGitOptions
{
gitPath
:
string
;
version
:
string
;
...
...
@@ -273,6 +261,11 @@ export class Git {
}
}
export
interface
ICommit
{
hash
:
string
;
message
:
string
;
}
export
class
Repository
{
private
git
:
Git
;
...
...
@@ -735,17 +728,15 @@ export class Repository {
},
()
=>
''
);
}
/** Implemented for use case `git log` and `git log -N`. */
getLog
(
options
?:
ILogOptions
):
TPromise
<
string
>
{
const
args
=
[
'
log
'
]
;
getCommit
(
ref
:
string
):
TPromise
<
ICommit
>
{
return
this
.
run
([
'
show
'
,
'
-s
'
,
'
--format=%H
\n
%B
'
,
ref
]).
then
(
result
=
>
{
const
match
=
/^
([
0-9a-f
]{40})\n([^]
*
)
$/m
.
exec
(
result
.
stdout
.
trim
())
;
if
(
options
)
{
if
(
options
.
prevCount
)
{
args
.
push
(
`-
${
options
.
prevCount
}
`
);
}
if
(
options
.
format
)
{
args
.
push
(
`--format=
${
options
.
format
}
`
);
}
}
if
(
!
match
)
{
return
TPromise
.
wrapError
(
'
bad commit format
'
);
}
return
this
.
run
(
args
,
{
log
:
false
}).
then
(
result
=>
{
return
result
.
stdout
.
trim
();
return
{
hash
:
match
[
1
],
message
:
match
[
2
]
};
});
}
...
...
src/vs/workbench/parts/git/node/rawGitService.ts
浏览文件 @
1d8ceaa1
...
...
@@ -8,8 +8,8 @@ import { join } from 'path';
import
{
TPromise
,
Promise
}
from
'
vs/base/common/winjs.base
'
;
import
{
detectMimesFromFile
,
detectMimesFromStream
}
from
'
vs/base/node/mime
'
;
import
{
realpath
,
exists
}
from
'
vs/base/node/pfs
'
;
import
{
Repository
,
GitError
,
ILogOptions
}
from
'
vs/workbench/parts/git/node/git.lib
'
;
import
{
IRawGitService
,
RawServiceState
,
IRawStatus
,
IRef
,
GitErrorCodes
,
IPushOptions
}
from
'
vs/workbench/parts/git/common/git
'
;
import
{
Repository
,
GitError
}
from
'
vs/workbench/parts/git/node/git.lib
'
;
import
{
IRawGitService
,
RawServiceState
,
IRawStatus
,
IRef
,
GitErrorCodes
,
IPushOptions
,
ICommit
}
from
'
vs/workbench/parts/git/common/git
'
;
import
Event
,
{
Emitter
,
fromPromise
}
from
'
vs/base/common/event
'
;
export
class
RawGitService
implements
IRawGitService
{
...
...
@@ -200,8 +200,8 @@ export class RawGitService implements IRawGitService {
return
this
.
repo
.
getCommitTemplate
();
}
get
Log
(
options
?:
ILogOptions
):
TPromise
<
string
>
{
return
this
.
repo
.
get
Log
(
options
);
get
Commit
(
ref
:
string
):
TPromise
<
ICommit
>
{
return
this
.
repo
.
get
Commit
(
ref
);
}
}
...
...
@@ -229,5 +229,5 @@ export class DelayedRawGitService implements IRawGitService {
detectMimetypes
(
path
:
string
,
treeish
?:
string
):
TPromise
<
string
[]
>
{
return
this
.
raw
.
then
(
r
=>
r
.
detectMimetypes
(
path
,
treeish
));
}
show
(
path
:
string
,
treeish
?:
string
):
TPromise
<
string
>
{
return
this
.
raw
.
then
(
r
=>
r
.
show
(
path
,
treeish
));
}
getCommitTemplate
():
TPromise
<
string
>
{
return
this
.
raw
.
then
(
r
=>
r
.
getCommitTemplate
());
}
get
Log
(
options
?:
ILogOptions
):
TPromise
<
string
>
{
return
this
.
raw
.
then
(
r
=>
r
.
getLog
(
options
));
}
get
Commit
(
ref
:
string
):
TPromise
<
ICommit
>
{
return
this
.
raw
.
then
(
r
=>
r
.
getCommit
(
ref
));
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录