Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
9a7fdb4a
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9a7fdb4a
编写于
10月 05, 2018
作者:
I
Ilya Biryukov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add APIs to git scc provider.
Fix for #59419.
上级
1bf1bc2c
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
72 addition
and
32 deletion
+72
-32
extensions/git/src/api/api1.ts
extensions/git/src/api/api1.ts
+30
-2
extensions/git/src/api/git.d.ts
extensions/git/src/api/git.d.ts
+29
-1
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+2
-2
extensions/git/src/decorationProvider.ts
extensions/git/src/decorationProvider.ts
+2
-2
extensions/git/src/repository.ts
extensions/git/src/repository.ts
+9
-25
未找到文件。
extensions/git/src/api/api1.ts
浏览文件 @
9a7fdb4a
...
...
@@ -5,7 +5,7 @@
import
{
Model
}
from
'
../model
'
;
import
{
Repository
as
BaseRepository
,
Resource
}
from
'
../repository
'
;
import
{
InputBox
,
Git
,
API
,
Repository
,
Remote
,
RepositoryState
,
Branch
,
Ref
,
Submodule
,
Commit
,
Change
,
RepositoryUIState
}
from
'
./git
'
;
import
{
InputBox
,
Git
,
API
,
Repository
,
Remote
,
RepositoryState
,
Branch
,
Ref
,
Submodule
,
Commit
,
Change
,
RepositoryUIState
,
Status
}
from
'
./git
'
;
import
{
Event
,
SourceControlInputBox
,
Uri
,
SourceControl
}
from
'
vscode
'
;
import
{
mapEvent
}
from
'
../util
'
;
...
...
@@ -17,7 +17,23 @@ class ApiInputBox implements InputBox {
export
class
ApiChange
implements
Change
{
constructor
(
_resource
:
Resource
)
{
}
constructor
(
private
readonly
resource
:
Resource
)
{
}
public
get
resourceUri
():
Uri
{
return
this
.
resource
.
resourceUri
;
}
public
get
status
():
Status
{
return
this
.
resource
.
type
;
}
public
get
original
():
Uri
{
return
this
.
resource
.
original
;
}
public
get
renameResourceUri
():
Uri
|
undefined
{
return
this
.
resource
.
renameResourceUri
;
}
}
export
class
ApiRepositoryState
implements
RepositoryState
{
...
...
@@ -79,6 +95,14 @@ export class ApiRepository implements Repository {
return
this
.
_repository
.
getObjectDetails
(
treeish
,
path
);
}
detectObjectType
(
object
:
string
):
Promise
<
{
mimetype
:
string
,
encoding
?:
string
}
>
{
return
this
.
_repository
.
detectObjectType
(
object
);
}
buffer
(
ref
:
string
,
filePath
:
string
):
Promise
<
Buffer
>
{
return
this
.
_repository
.
buffer
(
ref
,
filePath
);
}
diffWithHEAD
(
path
:
string
):
Promise
<
string
>
{
return
this
.
_repository
.
diffWithHEAD
(
path
);
}
...
...
@@ -150,6 +174,10 @@ export class ApiRepository implements Repository {
pull
():
Promise
<
void
>
{
return
this
.
_repository
.
pull
();
}
clean
(
filePaths
:
string
[])
{
return
this
.
_repository
.
clean
(
filePaths
.
map
(
p
=>
Uri
.
file
(
p
)));
}
}
export
class
ApiGit
implements
Git
{
...
...
extensions/git/src/api/git.d.ts
浏览文件 @
9a7fdb4a
...
...
@@ -56,8 +56,32 @@ export interface Remote {
readonly
isReadOnly
:
boolean
;
}
export
const
enum
Status
{
INDEX_MODIFIED
,
INDEX_ADDED
,
INDEX_DELETED
,
INDEX_RENAMED
,
INDEX_COPIED
,
MODIFIED
,
DELETED
,
UNTRACKED
,
IGNORED
,
ADDED_BY_US
,
ADDED_BY_THEM
,
DELETED_BY_US
,
DELETED_BY_THEM
,
BOTH_ADDED
,
BOTH_DELETED
,
BOTH_MODIFIED
}
export
interface
Change
{
// TODO
readonly
resourceUri
:
Uri
;
readonly
status
:
Status
;
readonly
original
:
Uri
;
readonly
renameResourceUri
:
Uri
|
undefined
;
}
export
interface
RepositoryState
{
...
...
@@ -93,6 +117,8 @@ export interface Repository {
show
(
ref
:
string
,
path
:
string
):
Promise
<
string
>
;
getCommit
(
ref
:
string
):
Promise
<
Commit
>
;
getObjectDetails
(
treeish
:
string
,
path
:
string
):
Promise
<
{
mode
:
string
,
object
:
string
,
size
:
number
}
>
;
detectObjectType
(
object
:
string
):
Promise
<
{
mimetype
:
string
,
encoding
?:
string
}
>
;
buffer
(
ref
:
string
,
filePath
:
string
):
Promise
<
Buffer
>
;
diffWithHEAD
(
path
:
string
):
Promise
<
string
>
;
diffWith
(
ref
:
string
,
path
:
string
):
Promise
<
string
>
;
...
...
@@ -118,6 +144,8 @@ export interface Repository {
fetch
(
remote
?:
string
,
ref
?:
string
):
Promise
<
void
>
;
pull
():
Promise
<
void
>
;
clean
(
filePaths
:
string
[]):
Promise
<
void
>
;
}
export
interface
API
{
...
...
extensions/git/src/commands.ts
浏览文件 @
9a7fdb4a
...
...
@@ -5,7 +5,7 @@
import
{
Uri
,
commands
,
Disposable
,
window
,
workspace
,
QuickPickItem
,
OutputChannel
,
Range
,
WorkspaceEdit
,
Position
,
LineChange
,
SourceControlResourceState
,
TextDocumentShowOptions
,
ViewColumn
,
ProgressLocation
,
TextEditor
,
MessageOptions
,
WorkspaceFolder
}
from
'
vscode
'
;
import
{
Git
,
CommitOptions
,
Stash
,
ForcePushMode
}
from
'
./git
'
;
import
{
Repository
,
Resource
,
Status
,
ResourceGroupType
}
from
'
./repository
'
;
import
{
Repository
,
Resource
,
ResourceGroupType
}
from
'
./repository
'
;
import
{
Model
}
from
'
./model
'
;
import
{
toGitUri
,
fromGitUri
}
from
'
./uri
'
;
import
{
grep
,
isDescendant
,
pathEquals
}
from
'
./util
'
;
...
...
@@ -15,7 +15,7 @@ import { lstat, Stats } from 'fs';
import
*
as
os
from
'
os
'
;
import
TelemetryReporter
from
'
vscode-extension-telemetry
'
;
import
*
as
nls
from
'
vscode-nls
'
;
import
{
Ref
,
RefType
,
Branch
,
GitErrorCodes
}
from
'
./api/git
'
;
import
{
Ref
,
RefType
,
Branch
,
GitErrorCodes
,
Status
}
from
'
./api/git
'
;
const
localize
=
nls
.
loadMessageBundle
();
...
...
extensions/git/src/decorationProvider.ts
浏览文件 @
9a7fdb4a
...
...
@@ -5,11 +5,11 @@
import
{
window
,
workspace
,
Uri
,
Disposable
,
Event
,
EventEmitter
,
DecorationData
,
DecorationProvider
,
ThemeColor
}
from
'
vscode
'
;
import
*
as
path
from
'
path
'
;
import
{
Repository
,
GitResourceGroup
,
Status
}
from
'
./repository
'
;
import
{
Repository
,
GitResourceGroup
}
from
'
./repository
'
;
import
{
Model
}
from
'
./model
'
;
import
{
debounce
}
from
'
./decorators
'
;
import
{
filterEvent
,
dispose
,
anyEvent
,
fireEvent
}
from
'
./util
'
;
import
{
GitErrorCodes
}
from
'
./api/git
'
;
import
{
GitErrorCodes
,
Status
}
from
'
./api/git
'
;
type
Callback
=
{
resolve
:
(
status
:
boolean
)
=>
void
,
reject
:
(
err
:
any
)
=>
void
};
...
...
extensions/git/src/repository.ts
浏览文件 @
9a7fdb4a
...
...
@@ -13,7 +13,7 @@ import * as path from 'path';
import
*
as
nls
from
'
vscode-nls
'
;
import
*
as
fs
from
'
fs
'
;
import
{
StatusBarCommands
}
from
'
./statusbar
'
;
import
{
Branch
,
Ref
,
Remote
,
RefType
,
GitErrorCodes
}
from
'
./api/git
'
;
import
{
Branch
,
Ref
,
Remote
,
RefType
,
GitErrorCodes
,
Status
}
from
'
./api/git
'
;
const
timeout
=
(
millis
:
number
)
=>
new
Promise
(
c
=>
setTimeout
(
c
,
millis
));
...
...
@@ -29,27 +29,6 @@ export const enum RepositoryState {
Disposed
}
export
const
enum
Status
{
INDEX_MODIFIED
,
INDEX_ADDED
,
INDEX_DELETED
,
INDEX_RENAMED
,
INDEX_COPIED
,
MODIFIED
,
DELETED
,
UNTRACKED
,
IGNORED
,
ADDED_BY_US
,
ADDED_BY_THEM
,
DELETED_BY_US
,
DELETED_BY_THEM
,
BOTH_ADDED
,
BOTH_DELETED
,
BOTH_MODIFIED
}
export
const
enum
ResourceGroupType
{
Merge
,
Index
,
...
...
@@ -104,7 +83,7 @@ export class Resource implements SourceControlResourceState {
}
};
private
getIconPath
(
theme
:
string
):
Uri
{
private
getIconPath
(
theme
:
string
):
Uri
|
undefined
{
switch
(
this
.
type
)
{
case
Status
.
INDEX_MODIFIED
:
return
Resource
.
Icons
[
theme
].
Modified
;
case
Status
.
MODIFIED
:
return
Resource
.
Icons
[
theme
].
Modified
;
...
...
@@ -122,6 +101,7 @@ export class Resource implements SourceControlResourceState {
case
Status
.
DELETED_BY_US
:
return
Resource
.
Icons
[
theme
].
Conflict
;
case
Status
.
BOTH_ADDED
:
return
Resource
.
Icons
[
theme
].
Conflict
;
case
Status
.
BOTH_MODIFIED
:
return
Resource
.
Icons
[
theme
].
Conflict
;
default
:
return
;
}
}
...
...
@@ -180,7 +160,7 @@ export class Resource implements SourceControlResourceState {
return
{
strikeThrough
,
faded
,
tooltip
,
light
,
dark
,
letter
,
color
,
source
:
'
git.resource
'
/*todo@joh*/
};
}
get
letter
():
string
{
get
letter
():
string
|
undefined
{
switch
(
this
.
type
)
{
case
Status
.
INDEX_MODIFIED
:
case
Status
.
MODIFIED
:
...
...
@@ -207,10 +187,12 @@ export class Resource implements SourceControlResourceState {
case
Status
.
BOTH_ADDED
:
case
Status
.
BOTH_MODIFIED
:
return
'
C
'
;
default
:
return
;
}
}
get
color
():
ThemeColor
{
get
color
():
ThemeColor
|
undefined
{
switch
(
this
.
type
)
{
case
Status
.
INDEX_MODIFIED
:
case
Status
.
MODIFIED
:
...
...
@@ -234,6 +216,8 @@ export class Resource implements SourceControlResourceState {
case
Status
.
BOTH_ADDED
:
case
Status
.
BOTH_MODIFIED
:
return
new
ThemeColor
(
'
gitDecoration.conflictingResourceForeground
'
);
default
:
return
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录