ソースを参照

Fixes #183 - group same domain/path into same remote

main
Eric Amodio 7年前
コミット
be5afb7c6d
3個のファイルの変更14行の追加7行の削除
  1. +7
    -1
      src/git/models/remote.ts
  2. +5
    -4
      src/git/parsers/remoteParser.ts
  3. +2
    -2
      src/views/remoteNode.ts

+ 7
- 1
src/git/models/remote.ts ファイルの表示

@ -10,7 +10,13 @@ export class GitRemote {
provider?: RemoteProvider;
constructor(public readonly repoPath: string, public readonly name: string, public readonly url: string, public readonly domain: string, public readonly path: string, public readonly types: GitRemoteType[]) {
constructor(
public readonly repoPath: string,
public readonly name: string,
public readonly domain: string,
public readonly path: string,
public readonly types: { type: GitRemoteType, url: string }[]
) {
this.provider = RemoteProviderFactory.getRemoteProvider(this.domain, this.path);
}
}

+ 5
- 4
src/git/parsers/remoteParser.ts ファイルの表示

@ -22,14 +22,15 @@ export class GitRemoteParser {
const [domain, path] = this.parseGitUrl(url);
let remote: GitRemote | undefined = groups[url];
const uniqueness = `${domain}/${path}`;
let remote: GitRemote | undefined = groups[uniqueness];
if (remote === undefined) {
remote = new GitRemote(repoPath, match[1], url, domain, path, [match[3] as GitRemoteType]);
remote = new GitRemote(repoPath, match[1], domain, path, [{ url: url, type: match[3] as GitRemoteType }]);
remotes.push(remote);
groups[url] = remote;
groups[uniqueness] = remote;
}
else {
remote.types.push(match[3] as GitRemoteType);
remote.types.push({ url: url, type: match[3] as GitRemoteType });
}
} while (match != null);

+ 2
- 2
src/views/remoteNode.ts ファイルの表示

@ -28,8 +28,8 @@ export class RemoteNode extends ExplorerNode {
}
getTreeItem(): TreeItem {
const fetch = this.remote.types.includes(GitRemoteType.Push);
const push = this.remote.types.includes(GitRemoteType.Push);
const fetch = this.remote.types.find(rt => rt.type === GitRemoteType.Fetch);
const push = this.remote.types.find(rt => rt.type === GitRemoteType.Push);
let separator;
if (fetch && push) {

読み込み中…
キャンセル
保存