List of usage examples for org.eclipse.jgit.api StashCreateCommand setIndexMessage
public StashCreateCommand setIndexMessage(String message)
The message will be formatted with the current branch, abbreviated commit id, and short commit message when used.
From source file:org.eclipse.egit.core.op.StashCreateOperation.java
License:Open Source License
public void execute(IProgressMonitor monitor) throws CoreException { IWorkspaceRunnable action = new IWorkspaceRunnable() { public void run(IProgressMonitor pm) throws CoreException { try { StashCreateCommand command = Git.wrap(repository).stashCreate(); if (message != null) { command.setIndexMessage(message); command.setWorkingDirectoryMessage(message); }/*w w w . java 2 s .com*/ commit = command.call(); } catch (JGitInternalException e) { throw new TeamException(e.getLocalizedMessage(), e.getCause()); } catch (GitAPIException e) { throw new TeamException(e.getLocalizedMessage(), e.getCause()); } finally { if (commit != null) repository.notifyIndexChanged(); pm.done(); } } }; ResourcesPlugin.getWorkspace().run(action, monitor != null ? monitor : new NullProgressMonitor()); }
From source file:org.eclipse.orion.server.git.servlets.GitStashHandlerV1.java
License:Open Source License
@Override protected boolean handlePost(RequestInfo requestInfo) throws ServletException { JSONObject requestPayload = requestInfo.getJSONRequest(); HttpServletRequest request = requestInfo.request; HttpServletResponse response = requestInfo.response; Repository db = requestInfo.db;//from w w w .j a v a 2 s . c o m String indexMessage = requestPayload.optString(GitConstants.KEY_STASH_INDEX_MESSAGE); String workingDirectoryMessage = requestPayload.optString(GitConstants.KEY_STASH_WORKING_DIRECTORY_MESSAGE); boolean includeUntracked = requestPayload.optBoolean(GitConstants.KEY_STASH_INCLUDE_UNTRACKED, false); try { Git git = new Git(db); StashCreateCommand stashCreate = git.stashCreate(); stashCreate.setPerson(new PersonIdent(db)); stashCreate.setIncludeUntracked(includeUntracked); if (!indexMessage.isEmpty()) stashCreate.setIndexMessage(indexMessage); if (!workingDirectoryMessage.isEmpty()) stashCreate.setWorkingDirectoryMessage(workingDirectoryMessage); stashCreate.call(); return true; } catch (Exception ex) { String msg = "An error occured for stash command."; return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, ex)); } }