blob: 90241a0281a2e2c8fe2c52cd26680c5f08c3d0b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import { CommitSummary } from "./commit";
import { Reference } from "./reference";
import { Repository } from "./repository";
export class Branch extends Reference {
public async latestCommit(): Promise<CommitSummary> {
const latest_commit = this._owner.nodegitRepository.getBranchCommit(this._ng_reference);
return {
id: (await latest_commit).sha(),
message: (await latest_commit).message(),
date: (await latest_commit).time()
};
}
public static async lookup(owner: Repository, branch: string): Promise<Branch | null> {
const reference = await owner.nodegitRepository.getBranch(branch).catch(err => {
if(err.errno === -3) {
return null;
}
throw(err);
});
return reference ? new Branch(owner, reference) : null;
}
}
|