Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,17 @@ export class SvnCommands implements IDisposable {

try {
if (branch.isNew) {
await repository.branch(branch.path);
const commitMessage = await window.showInputBox({
value: `Created new branch ${branch.name}`,
prompt: `Commit message for create branch ${branch.name}`
});

// If press ESC on commit message
if (commitMessage === undefined) {
return;
}

await repository.newBranch(branch.path, commitMessage);
} else {
await repository.switchBranch(branch.path);
}
Expand Down
7 changes: 5 additions & 2 deletions src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -629,9 +629,12 @@ export class Repository {
});
}

public async branch(name: string) {
public async newBranch(
name: string,
commitMessage: string = "Created new branch"
) {
return this.run(Operation.NewBranch, async () => {
await this.repository.branch(name);
await this.repository.newBranch(name, commitMessage);
this.updateRemoteChangedFiles();
});
}
Expand Down
7 changes: 5 additions & 2 deletions src/svnRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,10 @@ export class Repository {
return branches;
}

public async branch(name: string) {
public async newBranch(
name: string,
commitMessage: string = "Created new branch"
) {
const repoUrl = await this.getRepoUrl();
const newBranch = repoUrl + "/" + name;
const info = await this.getInfo();
Expand All @@ -346,7 +349,7 @@ export class Repository {
currentBranch,
newBranch,
"-m",
`Created new branch ${name}`
commitMessage
]);

await this.switchBranch(name);
Expand Down
1 change: 1 addition & 0 deletions src/test/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ suite("Commands Tests", () => {
testUtil.overrideNextShowQuickPick(0);
testUtil.overrideNextShowQuickPick(1);
testUtil.overrideNextShowInputBox("test");
testUtil.overrideNextShowInputBox("Created new branch test");
await commands.executeCommand("svn.switchBranch");

const repository = model.getRepository(checkoutDir) as Repository;
Expand Down
2 changes: 1 addition & 1 deletion src/test/repository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ suite("Repository Tests", () => {
}
assert.ok(newRepository);

await newRepository.branch("branches/test");
await newRepository.newBranch("branches/test");
const currentBranch = await newRepository.getCurrentBranch();

assert.equal(currentBranch, "branches/test");
Expand Down