使用nodegit创建本地推送到远程
因此,我尝试使用nodegit库以编程方式执行以下操作: 签出修补程序分支 从hotfix分支获取head commmit 创建主题分支,其标题指向热修复程序分支标题 将上游主题分支设置为远程 Cherry从master中选择提交并应用到主题分支 暂停 开发人员修复并提交本地更改 代码然后推送 自动创建拉取请求 看来我们一路都到了4号。当我使用VSO Rest SDK for node远程执行这些步骤并且没有冲突时,VSO上的一切都正常工作。它只是在本地使用nodegit 看起来所有从nodegit返回的对象都是本机对象,因此无法使用debug evaluate查看任何数据。去拿原型机。 这是nodegit代码。每次我尝试设置上游分支时,都会出现关于引用无效的错误。这是密码。看到什么了吗使用nodegit创建本地推送到远程,git,nodegit,Git,Nodegit,因此,我尝试使用nodegit库以编程方式执行以下操作: 签出修补程序分支 从hotfix分支获取head commmit 创建主题分支,其标题指向热修复程序分支标题 将上游主题分支设置为远程 Cherry从master中选择提交并应用到主题分支 暂停 开发人员修复并提交本地更改 代码然后推送 自动创建拉取请求 看来我们一路都到了4号。当我使用VSO Rest SDK for node远程执行这些步骤并且没有冲突时,VSO上的一切都正常工作。它只是在本地使用nodegit 看起来所有从nodeg
let hotfixBranch = conflict.parameters.ontoRefName.substr(conflict.parameters.ontoRefName.indexOf("hotfix"));
let topicBranch = conflict.parameters.generatedRefName.substr(conflict.parameters.generatedRefName.indexOf("hotfix"));
await this.checkoutRemoteBranch(this.repo, hotfixBranch)
.then(() => {
log.info(`Getting head commit for ${hotfixBranch}}`);
return this.repo.getHeadCommit()
})
.then(commit => {
log.info(`Creating local topic branch ${topicBranch} with head commit pointed to ${commit.id().tostrS()}`);
return this.repo.createBranch(topicBranch, commit, true);
})
.then((ref) => {
return git.Branch.setUpstream(ref, "origin")
})
.then(() => this.repo.checkoutBranch(topicBranch))
.then(() => {
log.info(`Performing cherry pick with id ${this.hotfixCommit.id().tostrS().cyan} ${"on branch".green} ${topicBranch.cyan}`);
return git.Cherrypick.cherrypick(this.repo, this.hotfixCommit, {});
})
.then(result => {
if (result === -1) {
log.section("Found cherry pick conflicts");
log.error("IMPORTANT");
log.instruction("---------");
log.instruction("You must now open the local enlistment and resolve the conflict. Perform the following steps");
log.instruction("1) Open the repo at: " + args.cloneRepoTo);
log.instruction("2) Fix any merge conflicts");
log.instruction("3) Stage the changes");
log.error("DO NOT PUSH THE CHANGES TO THE UPSTREAM BRANCH");
log.instruction("4) Come back to this window and PRESS ANY KEY TO CONTINUE");
return this.pressKeyToContinue();
}
return null;
})
.catch(err => {
log.error(`Error cherry picking to local branch ${err}`);
});
在上面的代码中,冲突是我用来构造本地nodegit对象的VSO对象