Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2c69e4e5
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,发现更多精彩内容 >>
提交
2c69e4e5
编写于
2月 13, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
git: renames
fixes #18654
上级
4481a752
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
36 addition
and
15 deletion
+36
-15
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+20
-9
extensions/git/src/model.ts
extensions/git/src/model.ts
+16
-6
未找到文件。
extensions/git/src/commands.ts
浏览文件 @
2c69e4e5
...
...
@@ -113,13 +113,13 @@ export class CommandCenter {
const
right
=
this
.
getRightResource
(
resource
);
const
title
=
this
.
getTitle
(
resource
);
if
(
!
left
)
{
if
(
!
right
)
{
// TODO
console
.
error
(
'
oh no
'
);
return
;
}
if
(
!
left
)
{
return
await
commands
.
executeCommand
<
void
>
(
'
vscode.open
'
,
right
);
}
...
...
@@ -130,11 +130,11 @@ export class CommandCenter {
switch
(
resource
.
type
)
{
case
Status
.
INDEX_MODIFIED
:
case
Status
.
INDEX_RENAMED
:
return
resource
.
uri
.
with
({
scheme
:
'
git
'
,
query
:
'
HEAD
'
});
return
resource
.
original
.
with
({
scheme
:
'
git
'
,
query
:
'
HEAD
'
});
case
Status
.
MODIFIED
:
const
uriString
=
resource
.
uri
.
toString
();
const
[
indexStatus
]
=
this
.
model
.
indexGroup
.
resources
.
filter
(
r
=>
r
.
uri
.
toString
()
===
uriString
);
const
uriString
=
resource
.
original
.
toString
();
const
[
indexStatus
]
=
this
.
model
.
indexGroup
.
resources
.
filter
(
r
=>
r
.
original
.
toString
()
===
uriString
);
if
(
indexStatus
)
{
return
resource
.
uri
.
with
({
scheme
:
'
git
'
});
...
...
@@ -149,6 +149,8 @@ export class CommandCenter {
case
Status
.
INDEX_MODIFIED
:
case
Status
.
INDEX_ADDED
:
case
Status
.
INDEX_COPIED
:
return
resource
.
uri
.
with
({
scheme
:
'
git
'
});
case
Status
.
INDEX_RENAMED
:
return
resource
.
uri
.
with
({
scheme
:
'
git
'
});
...
...
@@ -159,6 +161,15 @@ export class CommandCenter {
case
Status
.
MODIFIED
:
case
Status
.
UNTRACKED
:
case
Status
.
IGNORED
:
const
uriString
=
resource
.
uri
.
toString
();
const
[
indexStatus
]
=
this
.
model
.
indexGroup
.
resources
.
filter
(
r
=>
r
.
uri
.
toString
()
===
uriString
);
if
(
indexStatus
&&
indexStatus
.
rename
)
{
return
indexStatus
.
rename
;
}
return
resource
.
uri
;
case
Status
.
BOTH_MODIFIED
:
return
resource
.
uri
;
}
...
...
extensions/git/src/model.ts
浏览文件 @
2c69e4e5
...
...
@@ -43,8 +43,17 @@ export enum Status {
export
class
Resource
implements
SCMResource
{
get
uri
():
Uri
{
return
this
.
_uri
;
}
get
uri
():
Uri
{
if
(
this
.
rename
&&
(
this
.
_type
===
Status
.
MODIFIED
||
this
.
_type
===
Status
.
DELETED
||
this
.
_type
===
Status
.
INDEX_RENAMED
))
{
return
this
.
rename
;
}
return
this
.
_uri
;
}
get
type
():
Status
{
return
this
.
_type
;
}
get
original
():
Uri
{
return
this
.
_uri
;
}
get
rename
():
Uri
|
undefined
{
return
this
.
_rename
;
}
private
static
Icons
=
{
light
:
{
...
...
@@ -110,8 +119,8 @@ export class Resource implements SCMResource {
return
{
strikeThrough
:
this
.
strikeThrough
,
light
,
dark
};
}
constructor
(
private
_uri
:
Uri
,
private
_type
:
Status
)
{
constructor
(
private
_uri
:
Uri
,
private
_type
:
Status
,
private
_rename
?:
Uri
)
{
// console.log(this);
}
}
...
...
@@ -435,6 +444,7 @@ export class Model {
status
.
forEach
(
raw
=>
{
const
uri
=
Uri
.
file
(
path
.
join
(
this
.
repositoryRoot
,
raw
.
path
));
const
renameUri
=
raw
.
rename
?
Uri
.
file
(
path
.
join
(
this
.
repositoryRoot
,
raw
.
rename
))
:
undefined
;
switch
(
raw
.
x
+
raw
.
y
)
{
case
'
??
'
:
return
workingTree
.
push
(
new
Resource
(
uri
,
Status
.
UNTRACKED
));
...
...
@@ -454,13 +464,13 @@ export class Model {
case
'
M
'
:
index
.
push
(
new
Resource
(
uri
,
Status
.
INDEX_MODIFIED
));
isModifiedInIndex
=
true
;
break
;
case
'
A
'
:
index
.
push
(
new
Resource
(
uri
,
Status
.
INDEX_ADDED
));
break
;
case
'
D
'
:
index
.
push
(
new
Resource
(
uri
,
Status
.
INDEX_DELETED
));
break
;
case
'
R
'
:
index
.
push
(
new
Resource
(
uri
,
Status
.
INDEX_RENAMED
/*, raw.rename*/
));
break
;
case
'
R
'
:
index
.
push
(
new
Resource
(
uri
,
Status
.
INDEX_RENAMED
,
renameUri
));
break
;
case
'
C
'
:
index
.
push
(
new
Resource
(
uri
,
Status
.
INDEX_COPIED
));
break
;
}
switch
(
raw
.
y
)
{
case
'
M
'
:
workingTree
.
push
(
new
Resource
(
uri
,
Status
.
MODIFIED
/*, raw.rename*/
));
break
;
case
'
D
'
:
workingTree
.
push
(
new
Resource
(
uri
,
Status
.
DELETED
/*, raw.rename*/
));
break
;
case
'
M
'
:
workingTree
.
push
(
new
Resource
(
uri
,
Status
.
MODIFIED
,
renameUri
));
break
;
case
'
D
'
:
workingTree
.
push
(
new
Resource
(
uri
,
Status
.
DELETED
,
renameUri
));
break
;
}
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录