瀏覽代碼

Fixes #607 - adds more uniqueness to view node ids

main
Eric Amodio 6 年之前
父節點
當前提交
c904f99f12
共有 14 個檔案被更改,包括 33 行新增17 行删除
  1. +1
    -0
      CHANGELOG.md
  2. +5
    -3
      src/views/nodes/branchNode.ts
  3. +1
    -1
      src/views/nodes/branchOrTagFolderNode.ts
  4. +1
    -1
      src/views/nodes/branchTrackingStatusNode.ts
  5. +1
    -1
      src/views/nodes/branchesNode.ts
  6. +1
    -1
      src/views/nodes/remoteNode.ts
  7. +1
    -1
      src/views/nodes/remotesNode.ts
  8. +4
    -3
      src/views/nodes/repositoryNode.ts
  9. +1
    -1
      src/views/nodes/stashNode.ts
  10. +1
    -1
      src/views/nodes/stashesNode.ts
  11. +1
    -1
      src/views/nodes/statusFilesNode.ts
  12. +1
    -1
      src/views/nodes/tagNode.ts
  13. +1
    -1
      src/views/nodes/tagsNode.ts
  14. +13
    -1
      src/views/nodes/viewNode.ts

+ 1
- 0
CHANGELOG.md 查看文件

@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed ### Fixed
- Fixes [#606](https://github.com/eamodio/vscode-gitlens/issues/606) - ID for xxx is already registered?!
- Fixes [#607](https://github.com/eamodio/vscode-gitlens/issues/607) - Open file in Remote Doesn't URL encode - Fixes [#607](https://github.com/eamodio/vscode-gitlens/issues/607) - Open file in Remote Doesn't URL encode
## [9.3.0] - 2019-01-02 ## [9.3.0] - 2019-01-02

+ 5
- 3
src/views/nodes/branchNode.ts 查看文件

@ -30,9 +30,11 @@ export class BranchNode extends ViewRefNode implements Pageabl
} }
get id(): string { get id(): string {
return `gitlens:repository(${this.branch.repoPath})${this._root ? ':root:' : ''}:branch(${this.branch.name})${
this.branch.current ? '+current:' : ''
}${this.branch.remote ? '+remote' : ''}${this.branch.starred ? '+starred:' : ''}`;
return `${this._instanceId}:gitlens:repository(${this.branch.repoPath})${this._root ? ':root:' : ''}:branch(${
this.branch.name
})${this.branch.current ? '+current:' : ''}${this.branch.remote ? '+remote' : ''}${
this.branch.starred ? '+starred:' : ''
}`;
} }
get current(): boolean { get current(): boolean {

+ 1
- 1
src/views/nodes/branchOrTagFolderNode.ts 查看文件

@ -24,7 +24,7 @@ export class BranchOrTagFolderNode extends ViewNode {
} }
get id(): string { get id(): string {
return `gitlens:repository(${this.repoPath}):${this.type}-folder(${this.relativePath})`;
return `${this._instanceId}:gitlens:repository(${this.repoPath}):${this.type}-folder(${this.relativePath})`;
} }
async getChildren(): Promise<ViewNode[]> { async getChildren(): Promise<ViewNode[]> {

+ 1
- 1
src/views/nodes/branchTrackingStatusNode.ts 查看文件

@ -32,7 +32,7 @@ export class BranchTrackingStatusNode extends ViewNode implements
} }
get id(): string { get id(): string {
return `gitlens:repository(${this.status.repoPath}):${this._root ? 'root:' : ''}branch(${
return `${this._instanceId}:gitlens:repository(${this.status.repoPath}):${this._root ? 'root:' : ''}branch(${
this.status.ref this.status.ref
}):status:upstream:(${this.status.upstream}):${this.direction}`; }):status:upstream:(${this.status.upstream}):${this.direction}`;
} }

+ 1
- 1
src/views/nodes/branchesNode.ts 查看文件

@ -22,7 +22,7 @@ export class BranchesNode extends ViewNode {
} }
get id(): string { get id(): string {
return `gitlens:repository(${this.repo.path}):branches`;
return `${this._instanceId}:gitlens:repository(${this.repo.path}):branches`;
} }
async getChildren(): Promise<ViewNode[]> { async getChildren(): Promise<ViewNode[]> {

+ 1
- 1
src/views/nodes/remoteNode.ts 查看文件

@ -22,7 +22,7 @@ export class RemoteNode extends ViewNode {
} }
get id(): string { get id(): string {
return `gitlens:repository(${this.remote.repoPath}):remote(${this.remote.name})`;
return `${this._instanceId}:gitlens:repository(${this.remote.repoPath}):remote(${this.remote.name})`;
} }
async getChildren(): Promise<ViewNode[]> { async getChildren(): Promise<ViewNode[]> {

+ 1
- 1
src/views/nodes/remotesNode.ts 查看文件

@ -19,7 +19,7 @@ export class RemotesNode extends ViewNode {
} }
get id(): string { get id(): string {
return `gitlens:repository(${this.repo.path}):remotes`;
return `${this._instanceId}:gitlens:repository(${this.repo.path}):remotes`;
} }
async getChildren(): Promise<ViewNode[]> { async getChildren(): Promise<ViewNode[]> {

+ 4
- 3
src/views/nodes/repositoryNode.ts 查看文件

@ -41,7 +41,7 @@ export class RepositoryNode extends SubscribeableViewNode {
} }
get id(): string { get id(): string {
return `gitlens:repository(${this.repo.path})${this.repo.starred ? '+starred:' : ''}`;
return `${this._instanceId}:gitlens:repository(${this.repo.path})${this.repo.starred ? '+starred:' : ''}`;
} }
async getChildren(): Promise<ViewNode[]> { async getChildren(): Promise<ViewNode[]> {
@ -238,9 +238,10 @@ export class RepositoryNode extends SubscribeableViewNode {
@debug({ @debug({
args: { args: {
0: (e: RepositoryFileSystemChangeEvent) => 0: (e: RepositoryFileSystemChangeEvent) =>
`{ repository: ${e.repository ? e.repository.name : ''}, uris: [${e.uris
`{ repository: ${e.repository ? e.repository.name : ''}, uris(${e.uris.length}): [${e.uris
.slice(0, 1)
.map(u => u.fsPath) .map(u => u.fsPath)
.join(', ')}] }`
.join(', ')}${e.uris.length > 1 ? ', ...' : ''}] }`
} }
}) })
private onFileSystemChanged(e: RepositoryFileSystemChangeEvent) { private onFileSystemChanged(e: RepositoryFileSystemChangeEvent) {

+ 1
- 1
src/views/nodes/stashNode.ts 查看文件

@ -17,7 +17,7 @@ export class StashNode extends ViewRefNode {
} }
get id(): string { get id(): string {
return `gitlens:repository(${this.commit.repoPath}):stash(${this.commit.sha})`;
return `${this._instanceId}:gitlens:repository(${this.commit.repoPath}):stash(${this.commit.sha})`;
} }
get ref(): string { get ref(): string {

+ 1
- 1
src/views/nodes/stashesNode.ts 查看文件

@ -19,7 +19,7 @@ export class StashesNode extends ViewNode {
} }
get id(): string { get id(): string {
return `gitlens:repository(${this.repo.path}):stashes`;
return `${this._instanceId}:gitlens:repository(${this.repo.path}):stashes`;
} }
async getChildren(): Promise<ViewNode[]> { async getChildren(): Promise<ViewNode[]> {

+ 1
- 1
src/views/nodes/statusFilesNode.ts 查看文件

@ -33,7 +33,7 @@ export class StatusFilesNode extends ViewNode {
} }
get id(): string { get id(): string {
return `gitlens:repository(${this.status.repoPath}):status:files`;
return `${this._instanceId}:gitlens:repository(${this.status.repoPath}):status:files`;
} }
async getChildren(): Promise<ViewNode[]> { async getChildren(): Promise<ViewNode[]> {

+ 1
- 1
src/views/nodes/tagNode.ts 查看文件

@ -24,7 +24,7 @@ export class TagNode extends ViewRefNode implements PageableVi
} }
get id(): string { get id(): string {
return `gitlens:repository(${this.tag.repoPath}):tag(${this.tag.name})`;
return `${this._instanceId}:gitlens:repository(${this.tag.repoPath}):tag(${this.tag.name})`;
} }
get label(): string { get label(): string {

+ 1
- 1
src/views/nodes/tagsNode.ts 查看文件

@ -21,7 +21,7 @@ export class TagsNode extends ViewNode {
} }
get id(): string { get id(): string {
return `gitlens:repository(${this.repo.path}):tags`;
return `${this._instanceId}:gitlens:repository(${this.repo.path}):tags`;
} }
async getChildren(): Promise<ViewNode[]> { async getChildren(): Promise<ViewNode[]> {

+ 13
- 1
src/views/nodes/viewNode.ts 查看文件

@ -51,13 +51,25 @@ export interface ViewNode {
readonly id?: string; readonly id?: string;
} }
@logName<ViewNode>((c, name) => `${name}${c.id ? `(${c.id})` : ''}`)
let counter = 0;
function getViewNodeInstanceId() {
if (counter === Number.MAX_SAFE_INTEGER) {
counter = 0;
}
counter++;
return counter;
}
@logName<ViewNode>((c, name) => `${name}(${c.id || c._instanceId})`)
export abstract class ViewNode<TView extends View = View> { export abstract class ViewNode<TView extends View = View> {
protected readonly _instanceId: number;
constructor( constructor(
uri: GitUri, uri: GitUri,
public readonly view: TView, public readonly view: TView,
protected readonly parent?: ViewNode protected readonly parent?: ViewNode
) { ) {
this._instanceId = getViewNodeInstanceId();
this._uri = uri; this._uri = uri;
} }

Loading…
取消
儲存