-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { commands, window } from "vscode"; | ||
import { IBranchItem } from "../common/types"; | ||
import { isTrunk, selectBranch } from "../helpers/branch"; | ||
import { Repository } from "../repository"; | ||
import { Command } from "./command"; | ||
|
||
export class Merge extends Command { | ||
constructor() { | ||
super("svn.merge", { repository: true }); | ||
} | ||
|
||
public async execute(repository: Repository) { | ||
const branch = await selectBranch(repository); | ||
|
||
if (!branch) { | ||
return; | ||
} | ||
|
||
await this.merge(repository, branch); | ||
} | ||
|
||
async merge(repository: Repository, branch: IBranchItem) { | ||
let reintegrate = false; | ||
if (isTrunk(repository.currentBranch)) { | ||
reintegrate = true; | ||
} | ||
|
||
try { | ||
await repository.merge(branch.path, reintegrate); | ||
} catch (error) { | ||
if (typeof error === "object" && error.hasOwnProperty("stderrFormated")) { | ||
if (error.stderrFormated.includes("try updating first")) { | ||
const answer = await window.showErrorMessage( | ||
"Seems like you need to update first prior to merging. " + | ||
"Would you like to update now and try merging again?", | ||
"Yes", | ||
"No" | ||
); | ||
if (answer === "Yes") { | ||
await commands.executeCommand("svn.update"); | ||
await this.merge(repository, branch); | ||
} | ||
} else { | ||
window.showErrorMessage( | ||
"Unable to merge branch: " + error.stderrFormated | ||
); | ||
} | ||
} else { | ||
console.log(error); | ||
window.showErrorMessage("Unable to merge branch"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters