提交 2c2122ee 编写于 作者: W wbarajas@umich.edu

feature: add support to manually add repositories

上级 3fbfccad
......@@ -38,6 +38,15 @@
"dark": "resources/icons/dark/git.svg"
}
},
{
"command": "git.loadRepo",
"title": "%command.loadRepo%",
"category": "Git",
"icon": {
"light": "resources/icons/light/git.svg",
"dark": "resources/icons/dark/git.svg"
}
},
{
"command": "git.close",
"title": "%command.close%",
......@@ -336,6 +345,10 @@
"command": "git.init",
"when": "config.git.enabled"
},
{
"command": "git.loadRepo",
"when": "config.git.enabled"
},
{
"command": "git.close",
"when": "config.git.enabled && gitOpenRepositoryCount != 0"
......@@ -535,6 +548,11 @@
"group": "navigation",
"when": "config.git.enabled && !scmProvider && gitOpenRepositoryCount == 0 && workspaceFolderCount != 0"
},
{
"command": "git.loadRepo",
"group": "navigation",
"when": "config.git.enabled && !scmProvider && gitOpenRepositoryCount == 0 && workspaceFolderCount != 0"
},
{
"command": "git.commit",
"group": "navigation",
......
......@@ -3,6 +3,7 @@
"description": "Git SCM Integration",
"command.clone": "Clone",
"command.init": "Initialize Repository",
"command.loadRepo": "Load Repo",
"command.close": "Close Repository",
"command.refresh": "Refresh",
"command.openChange": "Open Changes",
......
......@@ -477,6 +477,37 @@ export class CommandCenter {
await this.model.tryOpenRepository(path);
}
@command('git.loadRepo', { repository: false })
async loadRepo(path?: string): Promise<void> {
if (!path) {
path = await window.showInputBox({
prompt: localize('repopath', "Repository Path"),
ignoreFocusOut: true
});
}
if (path) {
try {
if (this.model.getRepository(path)) {
await this.model.tryOpenRepository(path);
}
else {
window.showInformationMessage(localize('notfound', "Could not find a repository at this path"));
}
return;
}
catch (err) {
//If something went wrong, tryOpenRepository should have already given error
}
}
}
@command('git.close', { repository: true })
async close(repository: Repository): Promise<void> {
this.model.close(repository);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册