Skip to content

Commit

Permalink
Move Git history view to scm-extra package
Browse files Browse the repository at this point in the history
Signed-off-by: Nigel Westbury <[email protected]>
  • Loading branch information
westbury committed Mar 2, 2020
1 parent c965552 commit b24cc0d
Show file tree
Hide file tree
Showing 51 changed files with 1,258 additions and 840 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ cache:
- packages/preferences/node_modules
- packages/preview/node_modules
- packages/process/node_modules
- packages/scm-extra/node_modules
- packages/scm/node_modules
- packages/search-in-workspace/node_modules
- packages/task/node_modules
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## v0.17.0

Breaking changes:

- [scm][git] the History view (GitHistoryWidget) has moved from the git package to a new package, scm-extra, and
renamed to ScmHistoryWidget. GitNavigableListWidget has also moved.
CSS classes have been moved renamed accordingly. [6381](https://github.com/eclipse-theia/theia/pull/6381)

## v0.16.0

- [cli] added an additional flag to the `download:plugins` script [#7123](https://github.com/eclipse-theia/theia/pull/7123)
Expand Down
3 changes: 3 additions & 0 deletions configs/root-compilation.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
{
"path": "../packages/scm/compile.tsconfig.json"
},
{
"path": "../packages/scm-extra/compile.tsconfig.json"
},
{
"path": "../packages/search-in-workspace/compile.tsconfig.json"
},
Expand Down
1 change: 1 addition & 0 deletions examples/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@theia/preview": "^0.16.0",
"@theia/process": "^0.16.0",
"@theia/scm": "^0.16.0",
"@theia/scm-extra": "^0.16.0",
"@theia/search-in-workspace": "^0.16.0",
"@theia/task": "^0.16.0",
"@theia/terminal": "^0.16.0",
Expand Down
3 changes: 3 additions & 0 deletions examples/electron/compile.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@
{
"path": "../../packages/scm/compile.tsconfig.json"
},
{
"path": "../../packages/scm-extra/compile.tsconfig.json"
},
{
"path": "../../packages/search-in-workspace/compile.tsconfig.json"
},
Expand Down
1 change: 1 addition & 0 deletions examples/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@theia/preview": "^0.16.0",
"@theia/process": "^0.16.0",
"@theia/scm": "^0.16.0",
"@theia/scm-extra": "^0.16.0",
"@theia/search-in-workspace": "^0.16.0",
"@theia/task": "^0.16.0",
"@theia/terminal": "^0.16.0",
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/browser/shell/application-shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ export type ApplicationShellLayoutVersion =
/** layout versioning is introduced, unversioned layout are not compatible */
2.0 |
/** view containers are introduced, backward compatible to 2.0 */
3.0;
3.0 |
/** git history view is replaced by a more generic scm history view, backward compatible to 3.0 */
4.0;

/**
* When a version is increased, make sure to introduce a migration (ApplicationShellLayoutMigration) to this version.
*/
export const applicationShellLayoutVersion: ApplicationShellLayoutVersion = 3.0;
export const applicationShellLayoutVersion: ApplicationShellLayoutVersion = 4.0;

export const ApplicationShellOptions = Symbol('ApplicationShellOptions');
export const DockPanelRendererFactory = Symbol('DockPanelRendererFactory');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export namespace EditorDecorationStyle {
}
const index = styleSheet.insertRule('.' + selector + '{}', 0);
const rules = styleSheet.cssRules || styleSheet.rules;
const rule = rules.item(index);
const rule = rules[index];
if (rule && rule.type === CSSRule.STYLE_RULE) {
const styleRule = rule as CSSStyleRule;
styleProvider(styleRule.style);
Expand Down
3 changes: 3 additions & 0 deletions packages/git/compile.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
{
"path": "../scm/compile.tsconfig.json"
},
{
"path": "../scm-extra/compile.tsconfig.json"
},
{
"path": "../workspace/compile.tsconfig.json"
}
Expand Down
1 change: 1 addition & 0 deletions packages/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@theia/languages": "^0.16.0",
"@theia/navigator": "^0.16.0",
"@theia/scm": "^0.16.0",
"@theia/scm-extra": "^0.16.0",
"@theia/workspace": "^0.16.0",
"@types/diff": "^3.2.2",
"@types/p-queue": "^2.3.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/git/src/browser/blame/blame-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { BlameDecorator } from './blame-decorator';
import { EditorManager, EditorKeybindingContexts, EditorWidget, EditorTextFocusContext, StrictEditorTextFocusContext } from '@theia/editor/lib/browser';
import { BlameManager } from './blame-manager';
import URI from '@theia/core/lib/common/uri';
import { EDITOR_CONTEXT_MENU_GIT } from '../git-contribution';
import { EDITOR_CONTEXT_MENU_SCM } from '@theia/scm-extra/lib/browser/scm-extra-contribution';

import debounce = require('lodash.debounce');

Expand Down Expand Up @@ -136,7 +136,7 @@ export class BlameContribution implements CommandContribution, KeybindingContrib
}

registerMenus(menus: MenuModelRegistry): void {
menus.registerMenuAction(EDITOR_CONTEXT_MENU_GIT, {
menus.registerMenuAction(EDITOR_CONTEXT_MENU_SCM, {
commandId: BlameCommands.TOGGLE_GIT_ANNOTATIONS.id,
});
}
Expand Down
20 changes: 14 additions & 6 deletions packages/git/src/browser/diff/git-diff-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { FrontendApplication, AbstractViewContribution } from '@theia/core/lib/b
import { WidgetManager } from '@theia/core/lib/browser/widget-manager';
import { injectable, inject } from 'inversify';
import { GitDiffWidget, GIT_DIFF } from './git-diff-widget';
import { ScmService } from '@theia/scm/lib/browser/scm-service';
import { open, OpenerService } from '@theia/core/lib/browser';
import { NavigatorContextMenu, FileNavigatorContribution } from '@theia/navigator/lib/browser/navigator-contribution';
import { UriCommandHandler } from '@theia/core/lib/common/uri-command-handler';
Expand All @@ -27,8 +28,7 @@ import { FileSystem } from '@theia/filesystem/lib/common';
import { DiffUris } from '@theia/core/lib/browser/diff-uris';
import URI from '@theia/core/lib/common/uri';
import { GIT_RESOURCE_SCHEME } from '../git-resource';
import { Git } from '../../common';
import { GitRepositoryProvider } from '../git-repository-provider';
import { Git, Repository } from '../../common';
import { WorkspaceRootUriAwareCommandHandler } from '@theia/workspace/lib/browser/workspace-commands';
import { WorkspaceService } from '@theia/workspace/lib/browser';
import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
Expand Down Expand Up @@ -65,7 +65,7 @@ export class GitDiffContribution extends AbstractViewContribution<GitDiffWidget>
@inject(FileSystem) protected readonly fileSystem: FileSystem,
@inject(OpenerService) protected openerService: OpenerService,
@inject(MessageService) protected readonly notifications: MessageService,
@inject(GitRepositoryProvider) protected readonly repositoryProvider: GitRepositoryProvider
@inject(ScmService) protected readonly scmService: ScmService
) {
super({
widgetId: GIT_DIFF,
Expand All @@ -85,8 +85,8 @@ export class GitDiffContribution extends AbstractViewContribution<GitDiffWidget>

registerCommands(commands: CommandRegistry): void {
commands.registerCommand(GitDiffCommands.OPEN_FILE_DIFF, this.newWorkspaceRootUriAwareCommandHandler({
isVisible: uri => !!this.repositoryProvider.findRepository(uri),
isEnabled: uri => !!this.repositoryProvider.findRepository(uri),
isVisible: uri => !!this.findGitRepository(uri),
isEnabled: uri => !!this.findGitRepository(uri),
execute: async fileUri => {
await this.quickOpenService.chooseTagsAndBranches(
async (fromRevision, toRevision) => {
Expand All @@ -112,7 +112,7 @@ export class GitDiffContribution extends AbstractViewContribution<GitDiffWidget>
}
}
}
}, this.repositoryProvider.findRepository(fileUri));
}, this.findGitRepository(fileUri));
}
}));
}
Expand All @@ -126,6 +126,14 @@ export class GitDiffContribution extends AbstractViewContribution<GitDiffWidget>
});
}

protected findGitRepository(uri: URI): Repository | undefined {
const repo = this.scmService.findRepository(uri);
if (repo && repo.provider.id === 'git') {
return { localUri: repo.provider.rootUri };
}
return undefined;
}

async showWidget(options: Git.Options.Diff): Promise<GitDiffWidget> {
const widget = await this.widget;
await widget.setContent(options);
Expand Down
Loading

0 comments on commit b24cc0d

Please sign in to comment.