Skip to content

Commit

Permalink
Adds more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Jan 23, 2019
1 parent 5609142 commit e4f6f42
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/git/gitService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 } = {}
Expand Down Expand Up @@ -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 } = {}
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 5 additions & 1 deletion src/git/gitUri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '/';
Expand Down Expand Up @@ -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;

Expand Down
16 changes: 15 additions & 1 deletion src/views/nodes/fileHistoryTrackerNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -83,8 +84,12 @@ export class FileHistoryTrackerNode extends SubscribeableViewNode<FileHistoryVie
}

@gate()
@debug()
@debug({
exit: r => `returned ${r}`
})
async refresh(reset: boolean = false) {
const cc = Logger.getCorrelationContext();

if (reset) {
this._uri = unknownGitUri;
this.resetChild();
Expand All @@ -103,10 +108,16 @@ export class FileHistoryTrackerNode extends SubscribeableViewNode<FileHistoryVie
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;
}

Expand Down Expand Up @@ -137,6 +148,9 @@ export class FileHistoryTrackerNode extends SubscribeableViewNode<FileHistoryVie
this._uri = gitUri;
this.resetChild();

if (cc !== undefined) {
cc.exitDetails = `, uri=${Logger.toLoggable(this._uri)}`;
}
return false;
}

Expand Down
12 changes: 12 additions & 0 deletions src/views/nodes/lineHistoryTrackerNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -85,6 +86,8 @@ export class LineHistoryTrackerNode extends SubscribeableViewNode<LineHistoryVie
@gate()
@debug()
async refresh(reset: boolean = false) {
const cc = Logger.getCorrelationContext();

if (reset) {
this._uri = unknownGitUri;
this._selection = undefined;
Expand All @@ -105,13 +108,19 @@ export class LineHistoryTrackerNode extends SubscribeableViewNode<LineHistoryVie
this._selection = undefined;
this.resetChild();

if (cc !== undefined) {
cc.exitDetails = `, uri=${Logger.toLoggable(this._uri)}`;
}
return false;
}

if (
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;
}

Expand All @@ -129,6 +138,9 @@ export class LineHistoryTrackerNode extends SubscribeableViewNode<LineHistoryVie
this._selection = editor.selection;
this.resetChild();

if (cc !== undefined) {
cc.exitDetails = `, uri=${Logger.toLoggable(this._uri)}`;
}
return false;
}

Expand Down

0 comments on commit e4f6f42

Please sign in to comment.