本文整理汇总了TypeScript中nodegit.Reference类的典型用法代码示例。如果您正苦于以下问题:TypeScript Reference类的具体用法?TypeScript Reference怎么用?TypeScript Reference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Reference类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: clearBranchElement
.then(function(branchList) {
let count = 0;
clearBranchElement();
for (let i = 0; i < branchList.length; i++) {
//console.log(branchList[i].name() + "!!!!");
let bp = branchList[i].name().split("/");
Git.Reference.nameToId(repository, branchList[i].name()).then(function(oid) {
// Use oid
//console.log(oid + " TTTTTTTT");
if (branchList[i].isRemote()) {
remoteName[bp[bp.length-1]] = oid;
} else {
branchCommit.push(branchList[i]);
console.log(bp[bp.length - 1] + "--------" + oid.tostrS());
if (oid.tostrS() in bname) {
bname[oid.tostrS()].push(branchList[i]);
} else {
bname[oid.tostrS()] = [branchList[i]];
}
}
}, function(err) {
console.log(err + "?????????");
});
if (branchList[i].isRemote()) {
if (localBranches.indexOf(bp[bp.length - 1]) < 0) {
displayBranch(bp[bp.length - 1], "branch-dropdown", "checkoutRemoteBranch(this)");
}
} else {
localBranches.push(bp[bp.length - 1]);
displayBranch(bp[bp.length - 1], "branch-dropdown", "checkoutLocalBranch(this)");
}
}
})
示例2:
.then(function (repo) {
Git.Reference.list(repo).then(function (array) {
if (array.includes("refs/remotes/origin/" + name)) {
a.innerHTML += "<img src='./assets/remote-branch.png' width='20' height='20' align='right' title='Remote'>";
isRemote = 1
}
})
})
示例3: clearBranchElement
.then(function (branchList) {
let count = 0;
clearBranchElement();
//for each branch
for (let i = 0; i < branchList.length; i++) {
console.log("branch name: " + branchList[i].name());
//get simplified name
let bp = branchList[i].name().split("/")[branchList[i].name().split("/").length - 1];
Git.Reference.nameToId(repository, branchList[i].name()).then(function (oid) {
// Use oid
console.log("old id " + oid);
if (branchList[i].isRemote()) {
// for remote branches add oid and branch name to remote branches map
remoteName[bp] = oid;
} else {
//add branch name to the branch list
branchCommit.push(branchList[i]);
console.log(bp + " adding to end of " + oid.tostrS());
if (oid.tostrS() in bname) {
bname[oid.tostrS()].push(branchList[i]);
} else {
bname[oid.tostrS()] = [branchList[i]];
}
}
}, function (err) {
console.log("repo.ts, line 273, could not find referenced branch" + err);
});
if (branchList[i].isRemote()) {
if (localBranches.indexOf(bp) < 0) {
displayBranch(bp, "branch-dropdown", "checkoutRemoteBranch(this)");
}
} else {
localBranches.push(bp);
displayBranch(bp, "branch-dropdown", "checkoutLocalBranch(this)");
}
}
})
示例4: addAllAndCommit
export async function addAllAndCommit(path: string,
user: string,
commitMessage: string,
initial: boolean): Promise<void> {
Log.info(`git commit -a -m "${commitMessage}"`);
let repo: NodeGitRepository = await nodegit.Repository.open(path);
let index = await repo.openIndex();
await index.addAll();
await index.write();
let oid = await index.writeTree();
var author = nodegit.Signature.now(user, user);
var committer = nodegit.Signature.now(user, user);
if (initial)
return await repo.createCommit(HEAD, author, committer, commitMessage, oid, []);
let head = await nodegit.Reference.nameToId(repo, HEAD);
let parent = await repo.getCommit(head);
return await repo.createCommit(HEAD, author, committer, commitMessage, oid, [parent]);
}
示例5:
.then(repo => Git.Reference.nameToId(repo, reference))