Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
60f1c78b
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,发现更多精彩内容 >>
提交
60f1c78b
编写于
3月 27, 2017
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add telemetry to new git.clone action - take 2 (fixes #21563)
上级
228086cd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
51 deletion
+19
-51
extensions/git/package.json
extensions/git/package.json
+0
-9
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+19
-42
未找到文件。
extensions/git/package.json
浏览文件 @
60f1c78b
...
...
@@ -27,11 +27,6 @@
"title"
:
"%command.clone%"
,
"category"
:
"Git"
},
{
"command"
:
"git.cloneSilent"
,
"title"
:
"%command.clone%"
,
"category"
:
"Git"
},
{
"command"
:
"git.init"
,
"title"
:
"%command.init%"
,
...
...
@@ -221,10 +216,6 @@
"commandPalette"
:
[
{
"command"
:
"git.clone"
,
"when"
:
"false"
},
{
"command"
:
"git.cloneSilent"
,
"when"
:
"config.git.enabled"
},
{
...
...
extensions/git/src/commands.ts
浏览文件 @
60f1c78b
...
...
@@ -187,14 +187,16 @@ export class CommandCenter {
return
''
;
}
private
async
_clone
():
Promise
<
boolean
>
{
@
command
(
'
git.clone
'
,
true
)
async
clone
():
Promise
<
void
>
{
const
url
=
await
window
.
showInputBox
({
prompt
:
localize
(
'
repourl
'
,
"
Repository URL
"
),
ignoreFocusOut
:
true
});
if
(
!
url
)
{
throw
new
Error
(
'
no_URL
'
);
this
.
telemetryReporter
.
sendTelemetryEvent
(
'
clone
'
,
{
outcome
:
'
no_URL
'
});
return
;
}
const
parentPath
=
await
window
.
showInputBox
({
...
...
@@ -204,57 +206,32 @@ export class CommandCenter {
});
if
(
!
parentPath
)
{
throw
new
Error
(
'
no_directory
'
);
this
.
telemetryReporter
.
sendTelemetryEvent
(
'
clone
'
,
{
outcome
:
'
no_directory
'
});
return
;
}
const
clonePromise
=
this
.
git
.
clone
(
url
,
parentPath
);
window
.
setStatusBarMessage
(
localize
(
'
cloning
'
,
"
Cloning git repository...
"
),
clonePromise
);
let
repositoryPath
:
string
;
try
{
repositoryPath
=
await
clonePromise
;
const
repositoryPath
=
await
clonePromise
;
const
open
=
localize
(
'
openrepo
'
,
"
Open Repository
"
);
const
result
=
await
window
.
showInformationMessage
(
localize
(
'
proposeopen
'
,
"
Would you like to open the cloned repository?
"
),
open
);
const
openFolder
=
result
===
open
;
this
.
telemetryReporter
.
sendTelemetryEvent
(
'
clone
'
,
{
outcome
:
'
success
'
},
{
openFolder
:
openFolder
?
1
:
0
});
if
(
openFolder
)
{
commands
.
executeCommand
(
'
vscode.openFolder
'
,
Uri
.
file
(
repositoryPath
));
}
}
catch
(
err
)
{
if
(
/already exists and is not an empty directory/
.
test
(
err
&&
err
.
stderr
||
''
))
{
throw
new
Error
(
'
directory_not_empty
'
);
this
.
telemetryReporter
.
sendTelemetryEvent
(
'
clone
'
,
{
outcome
:
'
directory_not_empty
'
});
}
else
{
this
.
telemetryReporter
.
sendTelemetryEvent
(
'
clone
'
,
{
outcome
:
'
error
'
});
}
throw
err
;
}
const
open
=
localize
(
'
openrepo
'
,
"
Open Repository
"
);
const
result
=
await
window
.
showInformationMessage
(
localize
(
'
proposeopen
'
,
"
Would you like to open the cloned repository?
"
),
open
);
const
openFolder
=
result
===
open
;
if
(
openFolder
)
{
commands
.
executeCommand
(
'
vscode.openFolder
'
,
Uri
.
file
(
repositoryPath
));
}
return
openFolder
;
}
/**
* Attempts to clone a git repository. Throws descriptive errors
* for usual error cases. Returns whether the user chose to open
* the resulting folder or otherwise.
*
* This only exists for the walkthrough contribution to have good
* telemetry.
*
* TODO@Christof: when all the telemetry questions are answered,
* please clean this up into a single clone method.
*/
@
command
(
'
git.clone
'
,
true
)
async
clone
():
Promise
<
boolean
>
{
return
await
this
.
_clone
();
}
@
command
(
'
git.cloneSilent
'
,
true
)
async
cloneSilent
():
Promise
<
void
>
{
try
{
await
this
.
_clone
();
}
catch
(
err
)
{
// noop
}
}
@
command
(
'
git.init
'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录