提交 bd647b78 编写于 作者: P Peng Lyu

remove unused code

上级 d298248b
......@@ -331,7 +331,7 @@ export function mapCommentsToHead(prPatch: string, localDiff: string, comments:
for (let i = 0; i < comments.length; i++) {
let comment = comments[i];
let diffLine = getDiffLineByPosition(prPatch, comment.position);
let diffLine = getDiffLineByPosition(prPatch, comment.position | comment.original_position);
let positionInPr = diffLine.newLineNumber;
let newPosition = mapOldPositionToNew(localDiff, positionInPr);
comment.absolutePosition = newPosition;
......
......@@ -33,12 +33,6 @@ export class Protocol {
return this.owner ? `${this.owner}/${this.repositoryName}` : this.repositoryName;
}
public isFileUri: boolean;
public isScpUri: boolean;
public isValidUri: boolean;
public readonly url: vscode.Uri;
constructor(
uriString: string
......@@ -116,7 +110,7 @@ export class Protocol {
return null;
}
if (this.isFileUri) {
if (this.type === ProtocolType.Local) {
return this.url;
}
......
......@@ -60,12 +60,6 @@ export class Repository {
return this._remotes;
}
// todo
private _cloneUrl: Protocol;
get cloneUrl(): Protocol {
return this._cloneUrl;
}
private statusTimeout: any;
private disposables: vscode.Disposable[] = [];
......@@ -112,14 +106,6 @@ export class Repository {
this._HEAD = HEAD;
this._refs = refs;
this._remotes = remotes;
if (this._HEAD.upstream && this._HEAD.upstream.remote) {
let currentRemote = this._remotes.filter(remote => remote.remoteName === this._HEAD.upstream.remote);
if (currentRemote && currentRemote.length) {
this._cloneUrl = new Protocol(currentRemote[0].url);
}
}
this._onDidRunGitStatus.fire();
}
......
......@@ -18,11 +18,7 @@ export class PullRequestGitHelper {
let existing = await repository.getBranch(localBranchName);
if (existing) {
// already exist
await repository.checkout(localBranchName);
} else if (repository.cloneUrl.equals(pullRequest.head.repositoryCloneUrl)) {
// branch from the same repository
await repository.fetch('origin', localBranchName);
// already exist but the metadata is missing.
await repository.checkout(localBranchName);
} else {
// the branch is from a fork
......@@ -36,8 +32,8 @@ export class PullRequestGitHelper {
await repository.setTrackingBranch(localBranchName, `refs/remotes/${remoteName}/${pullRequest.head.ref}`);
}
let prConfigKey = `branch.${localBranchName}.${PullRequestMetadataKey}`;
await repository.setConfig(prConfigKey, PullRequestGitHelper.buildPullRequestMetadata(pullRequest));
let prBranchMetadataKey = `branch.${localBranchName}.${PullRequestMetadataKey}`;
await repository.setConfig(prBranchMetadataKey, PullRequestGitHelper.buildPullRequestMetadata(pullRequest));
}
static async checkout(repository: Repository, remote: Remote, branchName: string, pullRequest: PullRequestModel): Promise<void> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册