소스 검색

Closes #197 - Preview search matches

Adds file-based search options to placeholder text
main
Eric Amodio 7 년 전
부모
커밋
10d7f683d8
5개의 변경된 파일14개의 추가작업 그리고 20개의 파일을 삭제
  1. +1
    -0
      CHANGELOG.md
  2. +3
    -3
      README.md
  3. +4
    -4
      src/commands/showCommitSearch.ts
  4. +4
    -4
      src/gitService.ts
  5. +2
    -9
      src/views/commitNode.ts

+ 1
- 0
CHANGELOG.md 파일 보기

@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes issue where the `GitLens Results` view wouldn't properly update when replacing existing results
- Fixes issue where showing commit search (file-based) results in the `GitLens Results` view wouldn't only show the matching files -- closes [#197](https://github.com/eamodio/vscode-gitlens/issues/197)
## [7.2.0] - 2018-01-01
### Added

+ 3
- 3
README.md 파일 보기

@ -210,11 +210,11 @@ While GitLens is highly customizable and provides many [configuration settings](
- Adds a `Search Commits` command (`gitlens.showCommitSearch`) with a shortcut of `alt+/` to search for commits by message, author, file(s), commit id, or code changes
- Use `<message>` to search for commits with messages that match `<message>` -- See [Git docs](https://git-scm.com/docs/git-log#git-log---grepltpatterngt)
- Use `@<name>` to search for commits with authors that match `<name>` -- See [Git docs](https://git-scm.com/docs/git-log#git-log---authorltpatterngt)
- Use `@<pattern>` to search for commits with authors that match `<pattern>` -- See [Git docs](https://git-scm.com/docs/git-log#git-log---authorltpatterngt)
- Use `:<pattern>` to search for commits with file names that match `<pattern>` -- See [Git docs](https://git-scm.com/docs/git-log)
- Use `#<sha>` to search for a commit with id of `<sha>` -- See [Git docs](https://git-scm.com/docs/git-log)
- Use `~<regex>` to search for commits with differences whose patch text contains added/removed lines that match `<regex>` -- See [Git docs](https://git-scm.com/docs/git-log#git-log--Gltregexgt)
- Use `=<regex>` to search for commits with differences that change the number of occurrences of the specified string (i.e. addition/deletion) in a file -- See [Git docs](https://git-scm.com/docs/git-log#git-log--Sltstringgt)
- Use `~<pattern>` to search for commits with differences whose patch text contains added/removed lines that match `<pattern>` -- See [Git docs](https://git-scm.com/docs/git-log#git-log--Gltregexgt)
- Use `=<string>` to search for commits with differences that change the number of occurrences of the specified string (i.e. addition/deletion) in a file -- See [Git docs](https://git-scm.com/docs/git-log#git-log--Sltstringgt)
- Provides a `Show in Results` option to show the search results in the `GitLens Results` view
- Adds an on-demand, [customizable](#gitlens-results-view-settings) `GitLens Results` view to the Explorer activity

+ 4
- 4
src/commands/showCommitSearch.ts 파일 보기

@ -13,7 +13,7 @@ const searchByRegex = /^([@~=:#])/;
const searchByMap = new Map<string, GitRepoSearchBy>([
['@', GitRepoSearchBy.Author],
['~', GitRepoSearchBy.Changes],
['=', GitRepoSearchBy.ChangesOccurrences],
['=', GitRepoSearchBy.ChangedOccurrences],
[':', GitRepoSearchBy.Files],
['#', GitRepoSearchBy.Sha]
]);
@ -63,7 +63,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
args.search = await window.showInputBox({
value: args.search,
prompt: `Please enter a search string`,
placeHolder: `search by message, author (use @<name>), files (use :<pattern>), or commit id (use #<sha>)`
placeHolder: `search by message, author (@<pattern>), files (:<pattern>), commit id (#<sha>), changes (~<pattern>), or changed occurrences (=<string>)`
} as InputBoxOptions);
if (args.search === undefined) return args.goBackCommand === undefined ? undefined : args.goBackCommand.execute();
@ -96,8 +96,8 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
searchLabel = `commits with changes matching '${args.search}'`;
break;
case GitRepoSearchBy.ChangesOccurrences:
searchLabel = `commits with changes (new occurrences) matching '${args.search}'`;
case GitRepoSearchBy.ChangedOccurrences:
searchLabel = `commits with changed occurrences matching '${args.search}'`;
break;
case GitRepoSearchBy.Files:

+ 4
- 4
src/gitService.ts 파일 보기

@ -62,8 +62,8 @@ enum RemoveCacheReason {
export enum GitRepoSearchBy {
Author = 'author',
ChangedOccurrences = 'changed-occurrences',
Changes = 'changes',
ChangesOccurrences = 'changes-occurrences',
Files = 'files',
Message = 'message',
Sha = 'sha'
@ -1002,12 +1002,12 @@ export class GitService extends Disposable {
case GitRepoSearchBy.Author:
searchArgs = [`--author=${search}`];
break;
case GitRepoSearchBy.ChangedOccurrences:
searchArgs = [`-S${search}`, '--pickaxe-regex'];
break;
case GitRepoSearchBy.Changes:
searchArgs = [`-G${search}`];
break;
case GitRepoSearchBy.ChangesOccurrences:
searchArgs = [`-S${search}`, '--pickaxe-regex'];
break;
case GitRepoSearchBy.Files:
searchArgs = [`--`, `${search}`];
break;

+ 2
- 9
src/views/commitNode.ts 파일 보기

@ -24,14 +24,7 @@ export class CommitNode extends ExplorerRefNode {
}
async getChildren(): Promise<ExplorerNode[]> {
const repoPath = this.repoPath;
const log = await this.explorer.git.getLogForRepo(repoPath, { maxCount: 1, ref: this.commit.sha });
if (log === undefined) return [];
const commit = Iterables.first(log.commits.values());
if (commit === undefined) return [];
const commit = this.commit;
let children: IFileExplorerNode[] = [
...Iterables.map(commit.fileStatuses, s => new CommitFileNode(s, commit.toFileCommit(s), this.explorer, CommitFileNodeDisplayAs.File))
];
@ -40,7 +33,7 @@ export class CommitNode extends ExplorerRefNode {
const hierarchy = Arrays.makeHierarchical(children, n => n.uri.getRelativePath().split('/'),
(...paths: string[]) => GitService.normalizePath(path.join(...paths)), this.explorer.config.files.compact);
const root = new FolderNode(repoPath, '', undefined, hierarchy, this.explorer);
const root = new FolderNode(this.repoPath, '', undefined, hierarchy, this.explorer);
children = await root.getChildren() as IFileExplorerNode[];
}
else {

불러오는 중...
취소
저장