List of usage examples for org.eclipse.jgit.lib Constants MERGE_MSG
String MERGE_MSG
To view the source code for org.eclipse.jgit.lib Constants MERGE_MSG.
Click Source Link
From source file:com.mangosolutions.rcloud.rawgist.repository.git.BareCommitCommand.java
/** * Sets default values for not explicitly specified options. Then validates * that all required data has been provided. * * @param state/*ww w .j a v a2 s . co m*/ * the state of the repository we are working on * @param rw * the RevWalk to use * * @throws NoMessageException * if the commit message has not been specified */ private void processOptions(RepositoryState state, RevWalk rw) throws NoMessageException { if (committer == null) { committer = new PersonIdent(repo); } if (author == null && !amend) { author = committer; } if (allowEmpty == null) { // JGit allows empty commits by default. Only when pathes are // specified the commit should not be empty. This behaviour differs // from native git but can only be adapted in the next release. // TODO(ch) align the defaults with native git allowEmpty = (only.isEmpty()) ? Boolean.TRUE : Boolean.FALSE; } // when doing a merge commit parse MERGE_HEAD and MERGE_MSG files if (state == RepositoryState.MERGING_RESOLVED || isMergeDuringRebase(state)) { try { parents = repo.readMergeHeads(); if (parents != null) { for (int i = 0; i < parents.size(); i++) { RevObject ro = rw.parseAny(parents.get(i)); if (ro instanceof RevTag) parents.set(i, rw.peel(ro)); } } } catch (IOException e) { throw new JGitInternalException(MessageFormat.format( JGitText.get().exceptionOccurredDuringReadingOfGIT_DIR, Constants.MERGE_HEAD, e), e); } if (message == null) { try { message = repo.readMergeCommitMsg(); } catch (IOException e) { throw new JGitInternalException(MessageFormat.format( JGitText.get().exceptionOccurredDuringReadingOfGIT_DIR, Constants.MERGE_MSG, e), e); } } } else if (state == RepositoryState.SAFE && message == null) { try { message = repo.readSquashCommitMsg(); if (message != null) { repo.writeSquashCommitMsg(null /* delete */); } } catch (IOException e) { throw new JGitInternalException(MessageFormat .format(JGitText.get().exceptionOccurredDuringReadingOfGIT_DIR, Constants.MERGE_MSG, e), e); } } if (message == null) { // as long as we don't support -C option we have to have // an explicit message throw new NoMessageException(JGitText.get().commitMessageNotSpecified); } }
From source file:org.eclipse.egit.ui.internal.actions.CommitActionHandler.java
License:Open Source License
private String getMergeResolveMessage(Repository mergeRepository, ExecutionEvent event) throws ExecutionException { File mergeMsg = new File(mergeRepository.getDirectory(), Constants.MERGE_MSG); FileReader reader;/*w ww . j a v a 2 s .c o m*/ try { reader = new FileReader(mergeMsg); BufferedReader br = new BufferedReader(reader); try { StringBuilder message = new StringBuilder(); String s; String newLine = newLine(); while ((s = br.readLine()) != null) { message.append(s).append(newLine); } return message.toString(); } catch (IOException e) { MessageDialog.openError(getShell(event), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); throw new IllegalStateException(e); } finally { try { br.close(); } catch (IOException e) { // Empty } } } catch (FileNotFoundException e) { MessageDialog.openError(getShell(event), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_MergeHeadErrorMessage); throw new IllegalStateException(e); } }
From source file:org.eclipse.egit.ui.internal.commit.CommitHelper.java
License:Open Source License
private String getMergeResolveMessage(Repository mergeRepository) { File mergeMsg = new File(mergeRepository.getDirectory(), Constants.MERGE_MSG); FileReader reader;/*from w w w .jav a2 s. c o m*/ try { reader = new FileReader(mergeMsg); BufferedReader br = new BufferedReader(reader); try { StringBuilder message = new StringBuilder(); String s; String newLine = newLine(); while ((s = br.readLine()) != null) message.append(s).append(newLine); return message.toString(); } catch (IOException e) { throw new IllegalStateException(e); } finally { try { br.close(); } catch (IOException e) { // Empty } } } catch (FileNotFoundException e) { return NLS.bind(UIText.CommitHelper_couldNotFindMergeMsg, Constants.MERGE_MSG); } }
From source file:org.flowerplatform.web.git.operation.CommitOperation.java
License:Open Source License
private String getMergeResolveMessage(Repository mergeRepository) { File mergeMsg = new File(mergeRepository.getDirectory(), Constants.MERGE_MSG); FileReader reader;//from ww w. ja va 2 s . co m try { reader = new FileReader(mergeMsg); BufferedReader br = new BufferedReader(reader); try { StringBuilder message = new StringBuilder(); String s; String newLine = newLine(); while ((s = br.readLine()) != null) message.append(s).append(newLine); return message.toString(); } catch (IOException e) { throw new IllegalStateException(e); } finally { try { br.close(); } catch (IOException e) { // Empty } } } catch (FileNotFoundException e) { return null; } }