-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added log search commands (#782)
- Loading branch information
1 parent
d8bbe4c
commit 6fc635f
Showing
10 changed files
with
149 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,41 @@ | ||
import * as path from "path"; | ||
import { Command } from "./command"; | ||
import { window, Uri, commands } from "vscode"; | ||
import { Repository } from "../repository"; | ||
import { toSvnUri } from "../uri"; | ||
import { SvnUriAction } from "../common/types"; | ||
|
||
export class SearchLogByRevision extends Command { | ||
constructor() { | ||
super("svn.searchLogByRevision", { repository: true }); | ||
} | ||
|
||
public async execute(repository: Repository) { | ||
const input = await window.showInputBox({ prompt: "Revision?" }); | ||
if (!input) { | ||
return; | ||
} | ||
|
||
const revision = parseInt(input, 10); | ||
if (!revision || !/^\+?(0|[1-9]\d*)$/.test(input)) { | ||
window.showErrorMessage("Invalid revision"); | ||
return; | ||
} | ||
|
||
try { | ||
const resource = toSvnUri( | ||
Uri.file(repository.workspaceRoot), | ||
SvnUriAction.LOG_REVISION, | ||
{ revision } | ||
); | ||
const uri = resource.with({ | ||
path: path.join(resource.path, "svn.log") | ||
}); | ||
|
||
await commands.executeCommand<void>("vscode.open", uri); | ||
} catch (error) { | ||
console.error(error); | ||
window.showErrorMessage("Unable to log"); | ||
} | ||
} | ||
} |
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,35 @@ | ||
import * as path from "path"; | ||
import { Command } from "./command"; | ||
import { window, Uri, commands } from "vscode"; | ||
import { Repository } from "../repository"; | ||
import { toSvnUri } from "../uri"; | ||
import { SvnUriAction } from "../common/types"; | ||
|
||
export class SearchLogByText extends Command { | ||
constructor() { | ||
super("svn.searchLogByText", { repository: true }); | ||
} | ||
|
||
public async execute(repository: Repository) { | ||
const input = await window.showInputBox({ prompt: "Search query" }); | ||
if (!input) { | ||
return; | ||
} | ||
|
||
try { | ||
const resource = toSvnUri( | ||
Uri.file(repository.workspaceRoot), | ||
SvnUriAction.LOG_SEARCH, | ||
{ search: input } | ||
); | ||
const uri = resource.with({ | ||
path: path.join(resource.path, "svn.log") | ||
}); | ||
|
||
await commands.executeCommand<void>("vscode.open", uri); | ||
} catch (error) { | ||
console.error(error); | ||
window.showErrorMessage("Unable to log"); | ||
} | ||
} | ||
} |
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,14 @@ | ||
import { Disposable } from "vscode"; | ||
import * as semver from "semver"; | ||
import { setVscodeContext } from "../util"; | ||
|
||
export class IsSvn18orGreater implements Disposable { | ||
constructor(svnVersion: string) { | ||
const is18orGreater = semver.satisfies(svnVersion, ">= 1.8"); | ||
|
||
setVscodeContext("isSvn18orGreater", is18orGreater); | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
dispose() {} | ||
} |
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