public static ArrayMemory valueOf(RemoteRefUpdate value) { ArrayMemory memory = new ArrayMemory(); memory.refOfIndex("message").assign(value.getMessage()); memory.refOfIndex("remoteName").assign(value.getRemoteName()); memory.refOfIndex("srcRef").assign(value.getSrcRef()); memory.refOfIndex("expectedOldObjectId").assign(valueOf(value.getExpectedOldObjectId())); memory.refOfIndex("newObjectId").assign(valueOf(value.getNewObjectId())); memory.refOfIndex("delete").assign(value.isDelete()); memory.refOfIndex("fastForward").assign(value.isFastForward()); memory.refOfIndex("forceUpdate").assign(value.isForceUpdate()); return memory; }
/** * Update locally stored tracking branch with the new object. * * @param walk * walker used for checking update properties. * @throws java.io.IOException * when I/O error occurred during update */ protected void updateTrackingRef(RevWalk walk) throws IOException { if (isDelete()) trackingRefUpdate.setResult(localUpdate.delete(walk)); else trackingRefUpdate.setResult(localUpdate.update(walk)); }
/** * Update locally stored tracking branch with the new object. * * @param walk * walker used for checking update properties. * @throws IOException * when I/O error occurred during update */ protected void updateTrackingRef(final RevWalk walk) throws IOException { if (isDelete()) trackingRefUpdate.setResult(localUpdate.delete(walk)); else trackingRefUpdate.setResult(localUpdate.update(walk)); }
/** * Update locally stored tracking branch with the new object. * * @param walk * walker used for checking update properties. * @throws java.io.IOException * when I/O error occurred during update */ protected void updateTrackingRef(RevWalk walk) throws IOException { if (isDelete()) trackingRefUpdate.setResult(localUpdate.delete(walk)); else trackingRefUpdate.setResult(localUpdate.update(walk)); }
/** * Use with care! */ public boolean deleteBranch() { if (!branch.startsWith("feature/")) { throw new GitException("Can only delete feature branch."); } try { final Git git = gitOpen(); git.checkout().setCreateBranch(true).setName("feature/temp_" + UUID.randomUUID()).call(); List<String> deletedBranches = git.branchDelete().setBranchNames(branch).setForce(true).call(); if (deletedBranches.size() == 1) { // delete branch 'branchToDelete' on remote 'origin' RefSpec refSpec = new RefSpec().setSource(null).setDestination("refs/heads/" + branch); Iterable<PushResult> results = git.push().setCredentialsProvider(credentialsProvider()).setRefSpecs(refSpec).setRemote("origin").call(); for (PushResult result : results) { RemoteRefUpdate myUpdate = result.getRemoteUpdate("refs/heads/" + branch); if (myUpdate.isDelete() && myUpdate.getStatus() == RemoteRefUpdate.Status.OK) { return true; } } } return false; } catch (IOException | GitAPIException e) { throw new GitException("Delete branch failed", e); } }
for (PushResult result : results) { RemoteRefUpdate myUpdate = result.getRemoteUpdate("refs/heads/" + branch); if (myUpdate.isDelete() && myUpdate.getStatus() == RemoteRefUpdate.Status.OK) { return true;
if (update.isDelete()) styled.append(UIText.PushResultTable_statusOkDeleted, StyledString.DECORATIONS_STYLER);