Преглед изворни кода

Changes stash save icon

Renames existing stash save command
Adds new stash save command (per file)
main
Eric Amodio пре 6 година
родитељ
комит
18368caaa0
6 измењених фајлова са 47 додато и 15 уклоњено
  1. +5
    -0
      CHANGELOG.md
  2. +2
    -2
      images/dark/icon-stash-save.svg
  3. +2
    -2
      images/light/icon-stash-save.svg
  4. +22
    -9
      package.json
  5. +9
    -0
      src/commands/common.ts
  6. +7
    -2
      src/commands/stashSave.ts

+ 5
- 0
CHANGELOG.md Прегледај датотеку

@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [Unreleased]
### Changed
- Renames the _Stash Changes_ command (`gitlens.stashSave`) to _Stash All Changes_ and adds a new _Stash Changes_ command (`gitlens.stashSaveFiles`)
- Changes the icon of the _Stash All Changes_ command (`gitlens.stashSave`) — closes [Microsoft/vscode#64423](https://github.com/Microsoft/vscode/issues/64423)
### Fixed
- Fixes [#598](https://github.com/eamodio/vscode-gitlens/issues/598) — Apply changes when comparing a file from two branches is not working

+ 2
- 2
images/dark/icon-stash-save.svg Прегледај датотеку

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 22">
<path fill="#C5C5C5" d="M6.006 5.313h3.988-3.988zm3.988.945l-4.011.047 4.011-.047zm3.614-.124a.983.983 0 0 0-.955-.821L10 5.3v1l2.777-.042.955 6.688h-1.318a.991.991 0 0 0-.87.525l.01.01-.42.85a.97.97 0 0 1-.87.535H5.717a.962.962 0 0 1-.851-.525l-.42-.87a.974.974 0 0 0-.85-.525H2.268l.955-6.688L6 6.3v-1l-2.653.013a.983.983 0 0 0-.955.821l-1.08 6.821v4.777c0 .526.43.956.956.956h11.464c.526 0 .956-.43.956-.956v-4.777l-1.08-6.821z"/>
<path fill="#C5C5C5" d="M6.698 7.8H4.032l4 4 4-4H9.366L9.392 3h-2.72l.026 4.8z"/>
<path fill="#C5C5C5" d="M13 9.126a4.995 4.995 0 0 1-1.746 3.797L5.67 17.874l-1.324-1.496 5.595-4.962a3.01 3.01 0 0 0 1.061-2.29c0-1.654-1.345-3-2.997-3-.71 0-1.399.253-1.938.713L4.546 8.126h2.448l-1.998 2H1v-4l1.998-2v2.692l1.775-1.504a4.987 4.987 0 0 1 3.232-1.188 5.003 5.003 0 0 1 4.995 5z"/>
<path fill="#C5C5C5" stroke="#000" stroke-opacity=".6" stroke-width="2" d="M9.272 11h2.457v3.272H15v2.456h-3.271V20H9.272v-3.272H6v-2.456h3.272z" paint-order="stroke"/>
</svg>

+ 2
- 2
images/light/icon-stash-save.svg Прегледај датотеку

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 22">
<path fill="#424242" d="M6.006 5.313h3.988-3.988zm3.988.945l-4.011.047 4.011-.047zm3.614-.124a.983.983 0 0 0-.955-.821L10 5.3v1l2.777-.042.955 6.688h-1.318a.991.991 0 0 0-.87.525l.01.01-.42.85a.97.97 0 0 1-.87.535H5.717a.962.962 0 0 1-.851-.525l-.42-.87a.974.974 0 0 0-.85-.525H2.268l.955-6.688L6 6.3v-1l-2.653.013a.983.983 0 0 0-.955.821l-1.08 6.821v4.777c0 .526.43.956.956.956h11.464c.526 0 .956-.43.956-.956v-4.777l-1.08-6.821z"/>
<path fill="#424242" d="M6.698 7.8H4.032l4 4 4-4H9.366L9.392 3h-2.72l.026 4.8z"/>
<path fill="#424242" d="M13 9.126a4.995 4.995 0 0 1-1.746 3.797L5.67 17.874l-1.324-1.496 5.595-4.962a3.01 3.01 0 0 0 1.061-2.29c0-1.654-1.345-3-2.997-3-.71 0-1.399.253-1.938.713L4.546 8.126h2.448l-1.998 2H1v-4l1.998-2v2.692l1.775-1.504a4.987 4.987 0 0 1 3.232-1.188 5.003 5.003 0 0 1 4.995 5z"/>
<path fill="#424242" stroke="#FFF" stroke-opacity=".6" stroke-width="2" d="M9.272 11h2.457v3.272H15v2.456h-3.271V20H9.272v-3.272H6v-2.456h3.272z" paint-order="stroke"/>
</svg>

+ 22
- 9
package.json Прегледај датотеку

@ -2077,6 +2077,15 @@
},
{
"command": "gitlens.stashSave",
"title": "Stash All Changes",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-stash-save.svg",
"light": "images/light/icon-stash-save.svg"
}
},
{
"command": "gitlens.stashSaveFiles",
"title": "Stash Changes",
"category": "GitLens",
"icon": {
@ -2901,6 +2910,10 @@
"when": "gitlens:enabled && !gitlens:readonly"
},
{
"command": "gitlens.stashSaveFiles",
"when": "false"
},
{
"command": "gitlens.resetSuppressedWarnings",
"when": "gitlens:enabled"
},
@ -3504,7 +3517,7 @@
"group": "1_gitlens_1@2"
},
{
"command": "gitlens.stashSave",
"command": "gitlens.stashSaveFiles",
"when": "gitlens:enabled && !gitlens:readonly && config.gitlens.menus.scmItem.stash",
"group": "1_modification@-1"
},
@ -3955,7 +3968,7 @@
"group": "1_gitlens@1"
},
{
"command": "gitlens.stashSave",
"command": "gitlens.stashSaveFiles",
"when": "!gitlens:readonly && viewItem =~ /gitlens:file\\b.*:(un)?staged\\b/",
"group": "1_gitlens@2"
},
@ -4203,23 +4216,23 @@
"group": "2_gitlens@1"
},
{
"command": "gitlens.stashApply",
"when": "!gitlens:readonly && viewItem == gitlens:stashes",
"group": "inline@98"
},
{
"command": "gitlens.stashSave",
"when": "!gitlens:readonly && viewItem =~ /^gitlens:(stashes|status:files)$/",
"group": "inline@99"
"group": "inline@98"
},
{
"command": "gitlens.stashApply",
"when": "!gitlens:readonly && viewItem == gitlens:stashes",
"group": "1_gitlens@1"
"group": "inline@99"
},
{
"command": "gitlens.stashSave",
"when": "!gitlens:readonly && viewItem =~ /^gitlens:(stashes|status:files)$/",
"group": "1_gitlens@1"
},
{
"command": "gitlens.stashApply",
"when": "!gitlens:readonly && viewItem == gitlens:stashes",
"group": "1_gitlens@2"
},
{

+ 9
- 0
src/commands/common.ts Прегледај датотеку

@ -80,6 +80,7 @@ export enum Commands {
StashApply = 'gitlens.stashApply',
StashDelete = 'gitlens.stashDelete',
StashSave = 'gitlens.stashSave',
StashSaveFiles = 'gitlens.stashSaveFiles',
SupportGitLens = 'gitlens.supportGitLens',
SwitchMode = 'gitlens.switchMode',
ToggleCodeLens = 'gitlens.toggleCodeLens',
@ -286,6 +287,14 @@ export function isCommandViewContextWithRepo(
return (context.node as ViewNode & { repo?: Repository }).repo instanceof Repository;
}
export function isCommandViewContextWithRepoPath(
context: CommandContext
): context is CommandViewItemContext & { node: ViewNode & { repoPath: string } } {
if (context.type !== 'viewItem') return false;
return typeof (context.node as ViewNode & { repoPath?: string }).repoPath === 'string';
}
export type CommandContext =
| CommandScmGroupsContext
| CommandScmStatesContext

+ 7
- 2
src/commands/stashSave.ts Прегледај датотеку

@ -13,7 +13,8 @@ import {
Commands,
getRepoPathOrPrompt,
isCommandViewContextWithFile,
isCommandViewContextWithRepo
isCommandViewContextWithRepo,
isCommandViewContextWithRepoPath
} from './common';
export interface StashSaveCommandArgs {
@ -27,7 +28,7 @@ export interface StashSaveCommandArgs {
@command()
export class StashSaveCommand extends Command {
constructor() {
super(Commands.StashSave);
super([Commands.StashSave, Commands.StashSaveFiles]);
}
protected async preExecute(context: CommandContext, args: StashSaveCommandArgs = {}): Promise<any> {
@ -39,6 +40,10 @@ export class StashSaveCommand extends Command {
args = { ...args };
args.repoPath = context.node.repo.path;
}
else if (isCommandViewContextWithRepoPath(context)) {
args = { ...args };
args.repoPath = context.node.repoPath;
}
else if (context.type === 'scm-states') {
args = { ...args };
args.uris = context.scmResourceStates.map(s => s.resourceUri);

Loading…
Откажи
Сачувај