Browse Source

Adds more logging

main
Eric Amodio 6 years ago
parent
commit
e4f6f42400
4 changed files with 39 additions and 5 deletions
  1. +7
    -3
      src/git/gitService.ts
  2. +5
    -1
      src/git/gitUri.ts
  3. +15
    -1
      src/views/nodes/fileHistoryTrackerNode.ts
  4. +12
    -0
      src/views/nodes/lineHistoryTrackerNode.ts

+ 7
- 3
src/git/gitService.ts View File

@ -1679,7 +1679,9 @@ export class GitService implements Disposable {
async getRepoPath(filePath: string, options?: { ref?: string }): Promise<string | undefined>;
async getRepoPath(uri: Uri | undefined, options?: { ref?: string }): Promise<string | undefined>;
@log()
@log({
exit: path => `returned ${path}`
})
async getRepoPath(
filePathOrUri: string | Uri | undefined,
options: { ref?: string } = {}
@ -1795,7 +1797,9 @@ export class GitService implements Disposable {
repoPathOrUri: string | Uri,
options?: { ref?: string; skipCacheUpdate?: boolean }
): Promise<Repository | undefined>;
@log()
@log({
exit: repo => `returned ${repo !== undefined ? `${repo.path}` : 'undefined'}`
})
async getRepository(
repoPathOrUri: string | Uri,
options: { ref?: string; skipCacheUpdate?: boolean } = {}
@ -1985,7 +1989,7 @@ export class GitService implements Disposable {
): Promise<boolean>;
async isTracked(uri: GitUri): Promise<boolean>;
@log({
exit: tracked => tracked.toString(),
exit: tracked => `returned ${tracked.toString()}`,
singleLine: true
})
async isTracked(

+ 5
- 1
src/git/gitUri.ts View File

@ -5,7 +5,8 @@ import { UriComparer } from '../comparers';
import { DocumentSchemes, GlyphChars } from '../constants';
import { Container } from '../container';
import { GitCommit, GitFile, GitService } from '../git/gitService';
import { Strings } from '../system';
import { Logger } from '../logger';
import { debug, Strings } from '../system';
const empty = '';
const slash = '/';
@ -231,6 +232,9 @@ export class GitUri extends ((Uri as any) as UriEx) {
return new GitUri(uri);
}
@debug({
exit: uri => `returned ${Logger.toLoggable(uri)}`
})
static async fromUri(uri: Uri) {
if (uri instanceof GitUri) return uri;

+ 15
- 1
src/views/nodes/fileHistoryTrackerNode.ts View File

@ -4,6 +4,7 @@ import { UriComparer } from '../../comparers';
import { GlyphChars } from '../../constants';
import { Container } from '../../container';
import { GitCommitish, GitUri } from '../../git/gitService';
import { Logger } from '../../logger';
import { BranchesAndTagsQuickPick, CommandQuickPickItem } from '../../quickpicks';
import { debug, Functions, gate, log } from '../../system';
import { FileHistoryView } from '../fileHistoryView';
@ -83,8 +84,12 @@ export class FileHistoryTrackerNode extends SubscribeableViewNode
}
@gate()
@debug()
@debug({
exit: r => `returned ${r}`
})
async refresh(reset: boolean = false) {
const cc = Logger.getCorrelationContext();
if (reset) {
this._uri = unknownGitUri;
this.resetChild();
@ -103,10 +108,16 @@ export class FileHistoryTrackerNode extends SubscribeableViewNode
this._uri = unknownGitUri;
this.resetChild();
if (cc !== undefined) {
cc.exitDetails = `, uri=${Logger.toLoggable(this._uri)}`;
}
return false;
}
if (UriComparer.equals(editor!.document.uri, this.uri)) {
if (cc !== undefined) {
cc.exitDetails = `, uri=${Logger.toLoggable(this._uri)}`;
}
return true;
}
@ -137,6 +148,9 @@ export class FileHistoryTrackerNode extends SubscribeableViewNode
this._uri = gitUri;
this.resetChild();
if (cc !== undefined) {
cc.exitDetails = `, uri=${Logger.toLoggable(this._uri)}`;
}
return false;
}

+ 12
- 0
src/views/nodes/lineHistoryTrackerNode.ts View File

@ -4,6 +4,7 @@ import { UriComparer } from '../../comparers';
import { GlyphChars } from '../../constants';
import { Container } from '../../container';
import { GitCommitish, GitUri } from '../../git/gitService';
import { Logger } from '../../logger';
import { BranchesAndTagsQuickPick, CommandQuickPickItem } from '../../quickpicks';
import { debug, Functions, gate, log } from '../../system';
import { LinesChangeEvent } from '../../trackers/gitLineTracker';
@ -85,6 +86,8 @@ export class LineHistoryTrackerNode extends SubscribeableViewNode
@gate()
@debug()
async refresh(reset: boolean = false) {
const cc = Logger.getCorrelationContext();
if (reset) {
this._uri = unknownGitUri;
this._selection = undefined;
@ -105,6 +108,9 @@ export class LineHistoryTrackerNode extends SubscribeableViewNode
this._selection = undefined;
this.resetChild();
if (cc !== undefined) {
cc.exitDetails = `, uri=${Logger.toLoggable(this._uri)}`;
}
return false;
}
@ -112,6 +118,9 @@ export class LineHistoryTrackerNode extends SubscribeableViewNode
UriComparer.equals(editor!.document.uri, this.uri) &&
(this._selection !== undefined && editor.selection.isEqual(this._selection))
) {
if (cc !== undefined) {
cc.exitDetails = `, uri=${Logger.toLoggable(this._uri)}`;
}
return true;
}
@ -129,6 +138,9 @@ export class LineHistoryTrackerNode extends SubscribeableViewNode
this._selection = editor.selection;
this.resetChild();
if (cc !== undefined) {
cc.exitDetails = `, uri=${Logger.toLoggable(this._uri)}`;
}
return false;
}

Loading…
Cancel
Save