Pārlūkot izejas kodu

Closes #2081 adds new stash behaviors

main
Eric Amodio pirms 2 gadiem
vecāks
revīzija
0668039c4f
7 mainītis faili ar 53 papildinājumiem un 11 dzēšanām
  1. +15
    -8
      CHANGELOG.md
  2. +12
    -0
      src/commands/git/stash.ts
  3. +12
    -0
      src/env/node/git/localGitProvider.ts
  4. +1
    -0
      src/git/gitProvider.ts
  5. +7
    -1
      src/git/gitProviderService.ts
  6. +4
    -0
      src/plus/github/githubGitProvider.ts
  7. +2
    -2
      src/views/stashesView.ts

+ 15
- 8
CHANGELOG.md Parādīt failu

@ -6,23 +6,30 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [Unreleased]
## Fixed
### Added
- Adds new stash behaviors to use the Source Control (commit message) input box — closes [#2081](https://github.com/gitkraken/vscode-gitlens/issues/2081)
- When a stash is applied or popped and the Source Control input is empty, we will now update the Source Control input to the stash message
- When stashing changes and the Source Control input is not empty, we will now default the stash message input to the Source Control input value
### Fixed
- Fixes [#2048](https://github.com/gitkraken/vscode-gitlens/issues/2048) - Gitlens not loading in vscode.dev
- Fixes an issue where the _Stashes_ view empty state isn't displayed properly when there are no stashes
## [12.1.1] - 2022-06-16
## Added
### Added
- Adds getting started tutorial video to the Welcome, Get Started walkthrough, GitLens Home view, and README
## Fixed
### Fixed
- Fixes [#2037](https://github.com/gitkraken/vscode-gitlens/issues/2037) - Autolinks can end up getting saved with invalid (cached) properties
## [12.1.0] - 2022-06-14
## Added
### Added
- Adds [**rich integration**](https://github.com/gitkraken/vscode-gitlens#remote-provider-integrations-) with GitLab and GitLab self-managed instances — closes [#1236](https://github.com/gitkraken/vscode-gitlens/issues/1236)
- Adds associated pull request to line annotations and hovers
@ -48,7 +55,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- You can now see all autolinks found in the commits in the comparison regardless of whether its a provider-based autolink or a custom (user-provided) autolink
- Adds _Open Current Branch on Remote_ to the Command Palette — closes [#1718](https://github.com/gitkraken/vscode-gitlens/issues/1718)
## Changed
### Changed
- Improves how stashes are shown in the _Stashes_ view by separating the associated branch from the stash message — closes [#1523](https://github.com/gitkraken/vscode-gitlens/issues/1523)
- Changes previous Gerrit remote support to Google Source remote support — thanks to [PR #1954](https://github.com/gitkraken/vscode-gitlens/pull/1954) by Felipe Santos ([@felipecrs](https://github.com/felipecrs))
@ -56,7 +63,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Renames "Gutter Changes" annotations to "File Changes"
- Renames "Gutter Heatmap" annotations to "File Heatmap"
## Fixed
### Fixed
- Fixes [#2033](https://github.com/gitkraken/vscode-gitlens/issues/2033) - Diffing, applying, and restoring untracked files in a stash doesn't work
- Fixes [#2028](https://github.com/gitkraken/vscode-gitlens/issues/2028) - Branch names with special characters '<' also causes errors on the command line &mdash; thanks to [PR #2030](https://github.com/gitkraken/vscode-gitlens/pull/2030) by mcy-kylin ([@mcy-kylin](https://github.com/mcy-kylin))
@ -70,7 +77,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [12.0.7] - 2022-05-25
## Fixed
### Fixed
- Fixes [#1979](https://github.com/gitkraken/vscode-gitlens/issues/1979) - GitLens stopped working in v12.0.0 and later
- Fixes [#1882](https://github.com/gitkraken/vscode-gitlens/issues/1882) - Blame annotations not showing anymore after update
@ -82,7 +89,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [12.0.6] - 2022-04-12
## Fixed
### Fixed
- Fixes [#1928](https://github.com/gitkraken/vscode-gitlens/issues/1928) - Unable to get absolute uri between ex.txt and z:; Base path 'z:' must be an absolute path &mdash; thanks to [PR #1929](https://github.com/gitkraken/vscode-gitlens/pull/1929) by Ross Smith II ([@rasa](https://github.com/rasa))
- Fixes [#1932](https://github.com/gitkraken/vscode-gitlens/issues/1932) - Pull request autolink doesn't work for Bitbucket Server 7 &mdash; thanks to [PR #1933](https://github.com/gitkraken/vscode-gitlens/pull/1933) by Sam Martin ([@smartinio](https://github.com/smartinio))

+ 12
- 0
src/commands/git/stash.ts Parādīt failu

@ -301,6 +301,13 @@ export class StashGitCommand extends QuickCommand {
state.subcommand === 'pop' ? `stash@{${state.reference.number}}` : state.reference.ref,
{ deleteAfter: state.subcommand === 'pop' },
));
if (state.reference.message) {
const scmRepository = await this.container.git.getScmRepository(state.repo.path);
if (scmRepository != null && !scmRepository.inputBox.value) {
scmRepository.inputBox.value = state.reference.message;
}
}
} catch (ex) {
Logger.error(ex, context.title);
@ -467,6 +474,11 @@ export class StashGitCommand extends QuickCommand {
while (this.canStepsContinue(state)) {
if (state.counter < 3 || state.message == null) {
if (state.message == null) {
const scmRepository = await this.container.git.getScmRepository(state.repo.path);
state.message = scmRepository?.inputBox.value;
}
const result = yield* this.pushCommandInputMessageStep(state, context);
// Always break on the first step (so we will go back)
if (result === StepResult.Break) break;

+ 12
- 0
src/env/node/git/localGitProvider.ts Parādīt failu

@ -4004,6 +4004,18 @@ export class LocalGitProvider implements GitProvider, Disposable {
}
@log()
async getScmRepository(repoPath: string): Promise<ScmRepository | undefined> {
const cc = Logger.getCorrelationContext();
try {
const gitApi = await this.getScmGitApi();
return gitApi?.getRepository(Uri.file(repoPath)) ?? undefined;
} catch (ex) {
Logger.error(ex, cc);
return undefined;
}
}
@log()
async getOrOpenScmRepository(repoPath: string): Promise<ScmRepository | undefined> {
const cc = Logger.getCorrelationContext();
try {

+ 1
- 0
src/git/gitProvider.ts Parādīt failu

@ -119,6 +119,7 @@ export interface GitProvider extends Disposable {
visibility(repoPath: string): Promise<RepositoryVisibility>;
getOpenScmRepositories(): Promise<ScmRepository[]>;
getScmRepository(repoPath: string): Promise<ScmRepository | undefined>;
getOrOpenScmRepository(repoPath: string): Promise<ScmRepository | undefined>;
canHandlePathOrUri(scheme: string, pathOrUri: string | Uri): string | undefined;

+ 7
- 1
src/git/gitProviderService.ts Parādīt failu

@ -2305,7 +2305,13 @@ export class GitProviderService implements Disposable {
}
@log()
async getOrOpenScmRepository(repoPath: string): Promise<ScmRepository | undefined> {
getScmRepository(repoPath: string): Promise<ScmRepository | undefined> {
const { provider, path } = this.getProvider(repoPath);
return provider.getScmRepository(path);
}
@log()
getOrOpenScmRepository(repoPath: string): Promise<ScmRepository | undefined> {
const { provider, path } = this.getProvider(repoPath);
return provider.getOrOpenScmRepository(path);
}

+ 4
- 0
src/plus/github/githubGitProvider.ts Parādīt failu

@ -237,6 +237,10 @@ export class GitHubGitProvider implements GitProvider, Disposable {
return [];
}
async getScmRepository(_repoPath: string): Promise<ScmRepository | undefined> {
return undefined;
}
async getOrOpenScmRepository(_repoPath: string): Promise<ScmRepository | undefined> {
return undefined;
}

+ 2
- 2
src/views/stashesView.ts Parādīt failu

@ -67,7 +67,7 @@ export class StashesViewNode extends RepositoriesSubscribeableNode
const [child] = this.children;
const stash = await child.repo.getStash();
if (stash == null) {
if (stash == null || stash.commits.size === 0) {
this.view.message = 'No stashes could be found.';
this.view.title = 'Stashes';
@ -77,7 +77,7 @@ export class StashesViewNode extends RepositoriesSubscribeableNode
}
this.view.message = undefined;
this.view.title = `Stashes (${stash?.commits.size ?? 0})`;
this.view.title = `Stashes (${stash.commits.size})`;
return child.getChildren();
}

Notiek ielāde…
Atcelt
Saglabāt