@Test public void localChangesShouldBeAllowedWithFastForwardUpdate() throws Exception { createFileInCommand(projectRepoVirtualFile.findChild("com"), "b.txt", "other file"); runHg(projectRepo, "commit", "-m", "adding second file"); runHg(projectRepo, "push"); runHg(remoteRepo, "update"); changeFile_A_AndCommitInRemoteRepository(); fillFile(projectRepo, new String[] {"com", "b.txt"}, "local change"); createFileInCommand(projectRepoVirtualFile.findChild("com"), "c.txt", "other file"); assertIsChanged(HgFileStatusEnum.MODIFIED, "com", "b.txt"); assertIsChanged(HgFileStatusEnum.ADDED, "com", "c.txt"); PreUpdateInformation information = new PreUpdateInformation().getPreUpdateInformation(); HgRevisionNumber incomingHead = information.getIncomingHead(); List<VcsException> nonFatalWarnings = updateThroughPlugin(); assertTrue(nonFatalWarnings.isEmpty()); HgRevisionNumber parentAfterUpdate = new HgParentsCommand(myProject).execute(projectRepoVirtualFile).get(0); assertEquals(incomingHead, parentAfterUpdate); assertIsChanged(HgFileStatusEnum.MODIFIED, "com", "b.txt"); assertIsChanged(HgFileStatusEnum.ADDED, "com", "c.txt"); }
private void changeFile_A_AndCommitInRemoteRepository() throws IOException { fillFile(remoteRepo, new String[] {"com", "a.txt"}, "update file contents"); runHg(remoteRepo, "commit", "-m", "Adding history to remote repository"); assertEquals( determineNumberOfIncomingChanges(projectRepo), 1, "The remote repository should have gotten new history"); }