@Test public void updateKeepsWorkingAfterPull() throws Exception { changeFile_A_AndCommitInRemoteRepository(); // do a simple pull without an update HgPullCommand pull = new HgPullCommand(myProject, projectRepoVirtualFile); pull.setSource(new HgShowConfigCommand(myProject).getDefaultPath(projectRepoVirtualFile)); pull.setUpdate(false); pull.execute(); assertEquals( determineNumberOfIncomingChanges(projectRepo), 0, "The update operation should have pulled the incoming changes from the default repository."); updateThroughPlugin(); HgRevisionNumber parentRevision = new HgWorkingCopyRevisionsCommand(myProject).firstParent(projectRepoVirtualFile); assertEquals( parentRevision.getRevision(), "1", "The working directory should have been updated to the latest version"); }
private HgCommandExitCode pull(VirtualFile repo, ProgressIndicator indicator, boolean isRebase) throws VcsException { indicator.setText2(HgVcsMessages.message("hg4idea.progress.pull.with.update")); HgPullCommand hgPullCommand = new HgPullCommand(project, repo); final String defaultPath = HgUtil.getRepositoryDefaultPath(project, repo); hgPullCommand.setSource(defaultPath); if (isRebase) { hgPullCommand.setRebase(true); } else { hgPullCommand.setUpdate(true); } return hgPullCommand.execute(); }