本文整理汇总了Java中org.eclipse.jgit.api.errors.ConcurrentRefUpdateException类的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentRefUpdateException类的具体用法?Java ConcurrentRefUpdateException怎么用?Java ConcurrentRefUpdateException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConcurrentRefUpdateException类属于org.eclipse.jgit.api.errors包,在下文中一共展示了ConcurrentRefUpdateException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: forceUpdate
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
private void forceUpdate(final RefUpdate ru,
final ObjectId id) throws java.io.IOException, ConcurrentRefUpdateException {
final RefUpdate.Result rc = ru.forceUpdate();
switch (rc) {
case NEW:
case FORCED:
case FAST_FORWARD:
break;
case REJECTED:
case LOCK_FAILURE:
throw new ConcurrentRefUpdateException(JGitText.get().couldNotLockHEAD,
ru.getRef(),
rc);
default:
throw new JGitInternalException(MessageFormat.format(JGitText.get().updatingRefFailed,
Constants.HEAD,
id.toString(),
rc));
}
}
示例2: call
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
public Git call(final GitOperationsStep gitOperationsStep, Git git,
CredentialsProvider cp, String gitRepoUrl, File gitRepoFolder)
throws IllegalArgumentException, IOException,
ConcurrentRefUpdateException, InvalidTagNameException,
NoHeadException, GitAPIException {
TagCommand tc = git.tag().setAnnotated(annotated)
.setForceUpdate(forceUpdate).setSigned(signed);
if (!Const.isEmpty(this.message)) {
tc = tc.setMessage(gitOperationsStep
.environmentSubstitute(this.message));
}
if (!Const.isEmpty(this.name)) {
tc = tc.setName(gitOperationsStep.environmentSubstitute(this.name));
}
tc.call();
return git;
}
示例3: execute
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
public void execute() throws IOException, ConcurrentRefUpdateException {
final ObjectId headId = git.getLastCommit(Constants.R_HEADS + name);
final RefUpdate ru = git.getRepository().updateRef(Constants.R_HEADS + name);
if (headId == null) {
ru.setExpectedOldObjectId(ObjectId.zeroId());
} else {
ru.setExpectedOldObjectId(headId);
}
ru.setNewObjectId(commit.getId());
ru.setRefLogMessage(commit.getShortMessage(),
false);
forceUpdate(ru,
commit.getId());
}
示例4: execute
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
public void execute() throws java.io.IOException, ConcurrentRefUpdateException {
update(git.getRepository(),
Constants.R_HEADS + name,
commit);
//this `initialization` aims to be temporary
// -> without this cgit can't find master when cloning repos
if (name.equals(MASTER) && !git.isHEADInitialized()) {
synchronized (git.getRepository()) {
symRef(git,
HEAD,
Constants.R_HEADS + name);
git.setHeadAsInitialized();
}
}
}
示例5: execute
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
public void execute() {
final Repository repo = this.git.getRepository();
final RevCommit latestCommit = git.getLastCommit(branch);
final RevCommit startCommit = checkIfCommitIsPresentAtBranch(this.git,
this.branch,
this.startCommitString);
RevCommit parent = startCommit;
if (startCommit.getParentCount() > 0) {
parent = startCommit.getParent(0);
}
final CommitBuilder commitBuilder = new CommitBuilder();
commitBuilder.setParentId(parent);
commitBuilder.setTreeId(latestCommit.getTree().getId());
commitBuilder.setMessage(squashedCommitMessage);
commitBuilder.setAuthor(startCommit.getAuthorIdent());
commitBuilder.setCommitter(startCommit.getAuthorIdent());
try (final ObjectInserter odi = repo.newObjectInserter()) {
final RevCommit squashedCommit = git.resolveRevCommit(odi.insert(commitBuilder));
git.refUpdate(branch,
squashedCommit);
} catch (ConcurrentRefUpdateException | IOException e) {
throw new GitException("Error on executing squash.",
e);
}
}
示例6: refUpdate
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
@Override
public void refUpdate(final String branch,
final RevCommit commit)
throws IOException, ConcurrentRefUpdateException {
if (getRepository().getRefDatabase() instanceof RefTreeDatabase) {
new RefTreeUpdateCommand(this,
branch,
commit).execute();
} else {
new SimpleRefUpdateCommand(this,
branch,
commit).execute();
}
}
示例7: doHandle
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
private OneShotEvent doHandle(MergeRequestHookTriggerHandler mergeRequestHookTriggerHandler,
MergeRequestObjectAttributesBuilder objectAttributes) throws GitAPIException, IOException, NoHeadException,
NoMessageException, UnmergedPathsException, ConcurrentRefUpdateException, WrongRepositoryStateException,
AmbiguousObjectException, IncorrectObjectTypeException, MissingObjectException, InterruptedException {
Git.init().setDirectory(tmp.getRoot()).call();
tmp.newFile("test");
Git git = Git.open(tmp.getRoot());
git.add().addFilepattern("test");
RevCommit commit = git.commit().setMessage("test").call();
ObjectId head = git.getRepository().resolve(Constants.HEAD);
String repositoryUrl = tmp.getRoot().toURI().toString();
final OneShotEvent buildTriggered = new OneShotEvent();
FreeStyleProject project = jenkins.createFreeStyleProject();
project.setScm(new GitSCM(repositoryUrl));
project.getBuildersList().add(new TestBuilder() {
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
buildTriggered.signal();
return true;
}
});
project.setQuietPeriod(0);
mergeRequestHookTriggerHandler.handle(project, mergeRequestHook()
.withObjectAttributes(objectAttributes
.withTargetBranch("refs/heads/" + git.nameRev().add(head).call().get(head))
.withLastCommit(commit().withAuthor(user().withName("test").build()).withId(commit.getName()).build())
.build())
.withProject(project()
.withWebUrl("https://gitlab.org/test.git")
.build()
)
.build(), true, BranchFilterFactory.newBranchFilter(branchFilterConfig().build(BranchFilterType.All)),
newMergeRequestLabelFilter(null));
buildTriggered.block(10000);
return buildTriggered;
}
示例8: call
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
public Git call(final GitOperationsStep gitOperationsStep, Git git,
CredentialsProvider cp, String gitRepoUrl, File gitRepoFolder)
throws IllegalArgumentException, IOException, NoHeadException,
NoMessageException, UnmergedPathsException,
ConcurrentRefUpdateException, WrongRepositoryStateException,
GitAPIException {
CommitCommand cc = git
.commit()
.setAuthor(
gitOperationsStep
.environmentSubstitute(this.authorName == null ? ""
: this.authorName),
gitOperationsStep
.environmentSubstitute(this.authorEmail == null ? ""
: this.authorEmail))
.setCommitter(
gitOperationsStep
.environmentSubstitute(this.committerName == null ? ""
: this.committerName),
gitOperationsStep
.environmentSubstitute(this.committerEmail == null ? ""
: this.committerName));
if (!Const.isEmpty(this.commitMessage)) {
cc = cc.setMessage(gitOperationsStep
.environmentSubstitute(this.commitMessage));
}
cc.setAll(all).setInsertChangeId(insertChangeId).setAmend(amend).call();
return git;
}
示例9: copyDefaultTemplate
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
private Git copyDefaultTemplate(File tmpDir) throws URISyntaxException, IOException, NoFilepatternException,
NoHeadException, NoMessageException, UnmergedPathException, ConcurrentRefUpdateException,
WrongRepositoryStateException {
Git git;
copySkeleton(tmpDir);
git = Git.init().setDirectory(tmpDir).call();
git.add().addFilepattern(".").call();
git.commit().setCommitter("DevHub", "[email protected]").setMessage("Initial commit").call();
log.debug("Initialized git repo with default template");
return git;
}
示例10: createVersionFactory
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
@Before
public void createVersionFactory() throws IOException, NoHeadException,
NoMessageException, UnmergedPathsException,
ConcurrentRefUpdateException, WrongRepositoryStateException,
GitAPIException {
repo = createRepository();
git = initializeGitFlow(repo);
versionFactory = new TagBasedVersionFactory();
}
示例11: testHeadPointsAtStable
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
@Test
public void testHeadPointsAtStable() throws ConcurrentRefUpdateException,
InvalidTagNameException, NoHeadException, GitAPIException,
NoWorkTreeException, MissingObjectException,
IncorrectObjectTypeException, IOException {
tag("v1.0.0");
validateStableTag("1.0.0");
}
示例12: testHeadPointsAtStableWhenUsingPrefix
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
@Test
public void testHeadPointsAtStableWhenUsingPrefix() throws ConcurrentRefUpdateException,
InvalidTagNameException, NoHeadException, GitAPIException,
NoWorkTreeException, MissingObjectException,
IncorrectObjectTypeException, IOException {
versionFactory = new TagBasedVersionFactory("myPrefix");
tag("myPrefix-v1.0.0");
validateStableTag("1.0.0");
}
示例13: testHeadPointsOneAboveStable
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
@Test
public void testHeadPointsOneAboveStable()
throws ConcurrentRefUpdateException, InvalidTagNameException,
NoHeadException, GitAPIException, NoWorkTreeException,
MissingObjectException, IncorrectObjectTypeException, IOException {
tag("v1.0.0");
RevCommit head = makeCommit();
validateUnstable("1.0.0", 1, head, Dirty.NO, DOT);
}
示例14: testCommitCount
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
@Test
public void testCommitCount() throws NoHeadException, NoMessageException,
UnmergedPathsException, ConcurrentRefUpdateException,
WrongRepositoryStateException, GitAPIException,
NoWorkTreeException, IOException {
tag("v0.1.1-rc");
makeCommit();
makeCommit();
RevCommit head = makeCommit();
validateUnstable("0.1.1-rc", 3, head, Dirty.NO, DOT);
}
示例15: testVUnnecessary
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; //导入依赖的package包/类
@Test
public void testVUnnecessary() throws ConcurrentRefUpdateException,
InvalidTagNameException, NoHeadException, GitAPIException,
NoWorkTreeException, IOException {
makeCommit();
tag("0.1.0");
validateStableTag("0.1.0");
}