提交 c7fca1c1 编写于 作者: J Joao Moreno

git: checkout & branch commands

上级 79b37a7f
......@@ -119,6 +119,16 @@
"title": "Undo Last Commit",
"category": "Git"
},
{
"command": "git.checkout",
"title": "Checkout to...",
"category": "Git"
},
{
"command": "git.branch",
"title": "Create Branch...",
"category": "Git"
},
{
"command": "git.pull",
"title": "Pull",
......
......@@ -295,6 +295,36 @@ export class CommandCenter {
return await this.model.clean(...this.model.workingTreeGroup.resources);
}
@CommandCenter.Command('git.commitStaged')
@CommandCenter.CatchErrors
async commitStaged(): Promise<void> {
await Promise.reject('not implemented');
}
@CommandCenter.Command('git.commitStagedSigned')
@CommandCenter.CatchErrors
async commitStagedSigned(): Promise<void> {
await Promise.reject('not implemented');
}
@CommandCenter.Command('git.commitAll')
@CommandCenter.CatchErrors
async commitAll(): Promise<void> {
await Promise.reject('not implemented');
}
@CommandCenter.Command('git.commitAllSigned')
@CommandCenter.CatchErrors
async commitAllSigned(): Promise<void> {
await Promise.reject('not implemented');
}
@CommandCenter.Command('git.undoCommit')
@CommandCenter.CatchErrors
async undoCommit(): Promise<void> {
await Promise.reject('not implemented');
}
@CommandCenter.Command('git.checkout')
@CommandCenter.CatchErrors
async checkout(): Promise<void> {
......@@ -323,34 +353,20 @@ export class CommandCenter {
await choice.run(this.model);
}
@CommandCenter.Command('git.commitStaged')
@CommandCenter.CatchErrors
async commitStaged(): Promise<void> {
await Promise.reject('not implemented');
}
@CommandCenter.Command('git.commitStagedSigned')
@CommandCenter.CatchErrors
async commitStagedSigned(): Promise<void> {
await Promise.reject('not implemented');
}
@CommandCenter.Command('git.commitAll')
@CommandCenter.Command('git.branch')
@CommandCenter.CatchErrors
async commitAll(): Promise<void> {
await Promise.reject('not implemented');
}
async branch(): Promise<void> {
const result = await window.showInputBox({
placeHolder: 'Branch name',
prompt: 'Please provide a branch name'
});
@CommandCenter.Command('git.commitAllSigned')
@CommandCenter.CatchErrors
async commitAllSigned(): Promise<void> {
await Promise.reject('not implemented');
}
if (!result) {
return;
}
@CommandCenter.Command('git.undoCommit')
@CommandCenter.CatchErrors
async undoCommit(): Promise<void> {
await Promise.reject('not implemented');
const name = result.replace(/^\.|\/\.|\.\.|~|\^|:|\/$|\.lock$|\.lock\/|\\|\*|\s|^\s*$|\.$/g, '-');
await this.model.branch(name);
}
@CommandCenter.Command('git.pull')
......
......@@ -322,6 +322,11 @@ export class Model {
await this.update();
}
async branch(name: string): Promise<void> {
await this.repository.branch(name, true);
await this.update();
}
async checkout(treeish: string): Promise<void> {
await this.repository.checkout(treeish, []);
await this.update();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册