Package org.eclipse.egit.core.op

Examples of org.eclipse.egit.core.op.StashCreateOperation


    if (message.length() == 0)
      message = null;

    boolean includeUntracked = commitMessageDialog.getIncludeUntracked();

    final StashCreateOperation op = new StashCreateOperation(repo, message,
        includeUntracked);
    Job job = new WorkspaceJob(UIText.StashCreateCommand_jobTitle) {

      @Override
      public IStatus runInWorkspace(IProgressMonitor monitor) {
        monitor.beginTask("", 1); //$NON-NLS-1$
        try {
          op.execute(monitor);
          RevCommit commit = op.getCommit();
          if (commit == null)
            showNoChangesToStash();

        } catch (CoreException e) {
          Activator
              .logError(UIText.StashCreateCommand_stashFailed, e);
        }
        return Status.OK_STATUS;
      }

      @Override
      public boolean belongsTo(Object family) {
        if (JobFamilies.STASH.equals(family))
          return true;
        return super.belongsTo(family);
      }
    };
    job.setUser(true);
    job.setRule(op.getSchedulingRule());
    job.schedule();
    return true;

  }
View Full Code Here


  @Test
  public void testDefaultMessage() throws Exception {
    IFile file = testUtils.addFileToProject(project.getProject(),
        "foo/a.txt", "some text");
    new AddToIndexOperation(Arrays.asList(file)).execute(null);
    StashCreateOperation stashCreateOperation = new StashCreateOperation(repository);
    stashCreateOperation.execute(null);

    RevWalk revWalk = new RevWalk(repository);
    RevCommit commit = revWalk.parseCommit(repository.resolve("stash@{0}"));
    assertTrue(commit.getFullMessage().length() > 0);
  }
View Full Code Here

  public void testCustomMessage() throws Exception {
    IFile file = testUtils.addFileToProject(project.getProject(),
        "foo/a.txt", "some text");
    new AddToIndexOperation(Arrays.asList(file)).execute(null);
    String message = "stash message";
    StashCreateOperation stashCreateOperation = new StashCreateOperation(repository, message);
    stashCreateOperation.execute(null);

    RevWalk revWalk = new RevWalk(repository);
    RevCommit commit = revWalk.parseCommit(repository.resolve("stash@{0}"));
    assertEquals(message, commit.getFullMessage());
  }
View Full Code Here

  @Test
  public void testUntrackedFlag() throws Exception {
    testUtils.addFileToProject(project.getProject(), "foo/untracked.txt",
        "some text");
    String message = "stash with untracked files";
    StashCreateOperation stashCreateOperation = new StashCreateOperation(
        repository, message, true);
    stashCreateOperation.execute(null);

    RevWalk revWalk = new RevWalk(repository);
    RevCommit commit = revWalk.parseCommit(repository.resolve("stash@{0}"));
    // untracked commit is the third parent
    assertEquals(commit.getParentCount(), 3);
View Full Code Here

TOP

Related Classes of org.eclipse.egit.core.op.StashCreateOperation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.