org.eclipse.jgit.api.RebaseCommand.Operation Java Examples
The following examples show how to use
org.eclipse.jgit.api.RebaseCommand.Operation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JGitOperator.java From verigreen with Apache License 2.0 | 6 votes |
@Override public boolean rebase(String upStreamBranchName) { RebaseCommand command = _git.rebase(); RebaseResult result = null; try { command.setUpstream(upStreamBranchName); result = command.call(); // if there are merge conflicts (rebase interactive) - reset the repository if (!result.getStatus().isSuccessful()) { _git.rebase().setOperation(Operation.ABORT).call(); } } catch (Throwable e) { throw new RuntimeException(String.format( "Failed to rebase with upstream [%s]", upStreamBranchName), e); } return result.getStatus().isSuccessful(); }
Example #2
Source File: GitRebaseTest.java From orion.server with Eclipse Public License 1.0 | 5 votes |
@Test public void testRebaseInvalidOperation() throws Exception { createWorkspace(SimpleMetaStore.DEFAULT_WORKSPACE_NAME); IPath[] clonePaths = createTestProjects(workspaceLocation); for (IPath clonePath : clonePaths) { // clone a repo String contentLocation = clone(clonePath).getString(ProtocolConstants.KEY_CONTENT_LOCATION); // get project metadata WebRequest request = getGetRequest(contentLocation); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); JSONObject project = new JSONObject(response.getText()); JSONObject gitSection = project.getJSONObject(GitConstants.KEY_GIT); String gitHeadUri = gitSection.getString(GitConstants.KEY_HEAD); JSONObject rebase = rebase(gitHeadUri, Operation.CONTINUE); AdditionalRebaseStatus errRebaseResult = AdditionalRebaseStatus.valueOf(rebase.getString(GitConstants.KEY_RESULT)); assertEquals(AdditionalRebaseStatus.FAILED_WRONG_REPOSITORY_STATE, errRebaseResult); rebase = rebase(gitHeadUri, Operation.ABORT); errRebaseResult = AdditionalRebaseStatus.valueOf(rebase.getString(GitConstants.KEY_RESULT)); assertEquals(AdditionalRebaseStatus.FAILED_WRONG_REPOSITORY_STATE, errRebaseResult); rebase = rebase(gitHeadUri, Operation.SKIP); errRebaseResult = AdditionalRebaseStatus.valueOf(rebase.getString(GitConstants.KEY_RESULT)); assertEquals(AdditionalRebaseStatus.FAILED_WRONG_REPOSITORY_STATE, errRebaseResult); } }
Example #3
Source File: GitRebaseTest.java From orion.server with Eclipse Public License 1.0 | 5 votes |
public static WebRequest getPostGitRebaseRequest(String location, String commit, Operation operation) throws JSONException, UnsupportedEncodingException { String requestURI = toAbsoluteURI(location); JSONObject body = new JSONObject(); body.put(GitConstants.KEY_REBASE, commit); if (operation != null) body.put(GitConstants.KEY_OPERATION, operation.name()); WebRequest request = new PostMethodWebRequest(requestURI, IOUtilities.toInputStream(body.toString()), "UTF-8"); request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1"); setAuthentication(request); return request; }
Example #4
Source File: GitTest.java From orion.server with Eclipse Public License 1.0 | 5 votes |
protected JSONObject rebase(String gitHeadUri, Operation operation) throws IOException, SAXException, JSONException { assertCommitUri(gitHeadUri); WebRequest request = GitRebaseTest.getPostGitRebaseRequest(gitHeadUri, "", operation); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); return new JSONObject(response.getText()); }
Example #5
Source File: CherryPickCommand.java From netbeans with Apache License 2.0 | 4 votes |
static Operation getOperation (GitClient.RebaseOperationType operation) { return Operation.valueOf(operation.name()); }
Example #6
Source File: RebaseCommand.java From netbeans with Apache License 2.0 | 4 votes |
static Operation getOperation (GitClient.RebaseOperationType operation) { return Operation.valueOf(operation.name()); }