org.eclipse.jgit.api.errors.GitAPIException Java Examples

The following examples show how to use org.eclipse.jgit.api.errors.GitAPIException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WLGitBridgeIntegrationTest.java    From writelatex-git-bridge with MIT License 6 votes vote down vote up
@Test
public void pushFailsOnInvalidFiles() throws IOException, GitAPIException, InterruptedException {
    MockSnapshotServer server = new MockSnapshotServer(3869, getResource("/pushFailsOnInvalidFiles").toFile());
    server.start();
    server.setState(states.get("pushFailsOnInvalidFiles").get("state"));
    GitBridgeApp wlgb = new GitBridgeApp(new String[] {
        makeConfigFile(33869, 3869)
    });
    wlgb.run();
    File testprojDir = gitClone("testproj", 33869, dir);
    assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/pushFailsOnInvalidFiles/state/testproj"), testprojDir.toPath()));
    runtime.exec("touch push.tex", null, testprojDir).waitFor();
    gitAdd(testprojDir);
    gitCommit(testprojDir, "push");
    Process push = gitPush(testprojDir, 1);
    wlgb.stop();
    List<String> actual = Util.linesFromStream(push.getErrorStream(), 2, "[K");
    assertEquals(EXPECTED_OUT_PUSH_INVALID_FILES, actual);
}
 
Example #2
Source File: JGitUtil.java    From mcg-helper with Apache License 2.0 6 votes vote down vote up
public static boolean cloneRepository(String remoteUrl, String branch, String projectPath, String user, String pwd) throws InvalidRemoteException, TransportException, GitAPIException {
   	File projectDir = new File(projectPath);

       UsernamePasswordCredentialsProvider provider = new UsernamePasswordCredentialsProvider(user, pwd);
       try (Git git = Git.cloneRepository()
               .setURI(remoteUrl)
               .setBranch(branch)
               .setDirectory(projectDir)
               .setCredentialsProvider(provider)
               .setProgressMonitor(new CloneProgressMonitor())
               .call()) {
       	
       }
       
       return true;
}
 
Example #3
Source File: UnchangedProjectsRemoverTest.java    From gitflow-incremental-builder with MIT License 6 votes vote down vote up
@Test
public void singleChanged_buildUpstream_modeChanged() throws GitAPIException, IOException {
    MavenProject changedModuleMock = addModuleMock(AID_MODULE_B, true);
    MavenProject unchangedModuleMock = addModuleMock("unchanged-module", false);
    MavenProject dependsOnBothModuleMock = addModuleMock("changed-and-unchanged-dependent", false);

    when(mavenExecutionRequestMock.getMakeBehavior()).thenReturn(MavenExecutionRequest.REACTOR_MAKE_UPSTREAM);

    setUpAndDownstreamsForBuildUpstreamModeTests(changedModuleMock, unchangedModuleMock, dependsOnBothModuleMock);

    addGibProperty(Property.buildUpstreamMode, "changed");

    underTest.act();

    verify(mavenSessionMock).setProjects(Arrays.asList(moduleA, changedModuleMock, dependsOnBothModuleMock));

    assertProjectPropertiesEqual(moduleA, Collections.emptyMap());
    assertProjectPropertiesEqual(changedModuleMock, Collections.emptyMap());
    assertProjectPropertiesEqual(unchangedModuleMock, Collections.emptyMap());
    assertProjectPropertiesEqual(dependsOnBothModuleMock, Collections.emptyMap());
}
 
Example #4
Source File: SubmoduleStatusCommand.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
protected void run () throws GitException {
    Repository repository = getRepository();
    File workTree = repository.getWorkTree();
    org.eclipse.jgit.api.SubmoduleStatusCommand cmd = new Git(repository).submoduleStatus();
    for (String path : Utils.getRelativePaths(workTree, roots)) {
        cmd.addPath(path);
    }
    try {
        Map<String, SubmoduleStatus> result = cmd.call();
        GitClassFactory fac = getClassFactory();
        for (Map.Entry<String, SubmoduleStatus> e : result.entrySet()) {
            File root = new File(workTree, e.getKey());
            statuses.put(root, fac.createSubmoduleStatus(e.getValue(), root));
        }
    } catch (GitAPIException | JGitInternalException ex) {
        throw new GitException(ex);
    }
}
 
Example #5
Source File: GitConfigStoreTest.java    From vertx-config with Apache License 2.0 6 votes vote down vote up
@Test
public void testWith2FileSetsAndNoIntersection(TestContext tc) throws GitAPIException, IOException {
  Async async = tc.async();
  add(git, root, new File("src/test/resources/files/regular.json"), "file");
  add(git, root, new File("src/test/resources/files/a.json"), "dir");
  push(git);

  retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(new
      ConfigStoreOptions().setType("git").setConfig(new JsonObject()
      .put("url", bareRoot.getAbsolutePath())
      .put("path", "target/junk/work")
      .put("filesets", new JsonArray()
          .add(new JsonObject().put("pattern", "file/reg*.json"))
          .add(new JsonObject().put("pattern", "dir/a.*son"))
      ))));

  retriever.getConfig(ar -> {
    assertThat(ar.result().getString("key")).isEqualTo("value");
    assertThat(ar.result().getString("a.name")).isEqualTo("A");
    async.complete();
  });

}
 
Example #6
Source File: LocalRepoMock.java    From gitflow-incremental-builder with MIT License 6 votes vote down vote up
public LocalRepoMock(File baseFolder, TestServerType remoteRepoServerType) throws IOException, URISyntaxException, GitAPIException {
    this.baseFolder = new File(baseFolder.getAbsolutePath(), "tmp/repo/");
    new UnZipper().act(templateProjectZip, this.baseFolder);

    remoteRepo = remoteRepoServerType != null ? new RemoteRepoMock(baseFolder, remoteRepoServerType) : null;
    git = new Git(new FileRepository(new File(this.baseFolder, ".git")));

    if (remoteRepoServerType != null) {
        try {
            configureRemote(git, remoteRepo.repoUri.toString());
        } catch (IOException | URISyntaxException | GitAPIException | RuntimeException e) {
            close();
            throw e;
        }
    }
}
 
Example #7
Source File: GitPull.java    From nano-framework with Apache License 2.0 6 votes vote down vote up
public GitPull quickPull(String... args) {
    if (!ArrayUtils.isEmpty(args)) {
        for (final String arg : args) {
            if (StringUtils.equals("stop", StringUtils.lowerCase(arg))) {
                return this;
            }
        }
    }

    if (enabled) {
        try {
            return dir().pull().copy().clean();
        } catch (final IOException | GitAPIException e) {
            throw new org.nanoframework.server.exception.GitAPIException(e.getMessage(), e);
        }
    }

    return this;
}
 
Example #8
Source File: WLGitBridgeIntegrationTest.java    From writelatex-git-bridge with MIT License 6 votes vote down vote up
@Test
public void pushFailsOnInvalidProject() throws IOException, GitAPIException, InterruptedException {
    MockSnapshotServer server = new MockSnapshotServer(3870, getResource("/pushFailsOnInvalidProject").toFile());
    server.start();
    server.setState(states.get("pushFailsOnInvalidProject").get("state"));
    GitBridgeApp wlgb = new GitBridgeApp(new String[] {
        makeConfigFile(33870, 3870)
    });
    wlgb.run();
    File testprojDir = gitClone("testproj", 33870, dir);
    assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/pushFailsOnInvalidProject/state/testproj"), testprojDir.toPath()));
    runtime.exec("touch push.tex", null, testprojDir).waitFor();
    gitAdd(testprojDir);
    gitCommit(testprojDir, "push");
    Process push = gitPush(testprojDir, 1);
    wlgb.stop();
    List<String> actual = Util.linesFromStream(push.getErrorStream(), 2, "[K");
    assertEquals(EXPECTED_OUT_PUSH_INVALID_PROJECT, actual);
}
 
Example #9
Source File: GitProctorCore.java    From proctor with Apache License 2.0 6 votes vote down vote up
@Nullable
private Set<String> parseStagedTestNames() {
    try {
        final Status status = git.status().call();
        return Stream.of(
                status.getAdded(),
                status.getChanged(),
                status.getRemoved())
                .flatMap(Set::stream)
                .distinct()
                .map(s -> parseTestName(testDefinitionsDirectory, s))
                .filter(Objects::nonNull)
                .collect(Collectors.toSet());
    } catch (final GitAPIException | NoWorkTreeException e) {
        LOGGER.warn("Failed to call git status", e);
        return null;
    }
}
 
Example #10
Source File: SquashActionHandler.java    From WebIDE-Backend with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public RebaseResponse process(Repository repository, String message) throws GitAPIException, IOException {

    try (Git git = Git.wrap(repository)) {
        git.commit()
                .setMessage(stripCommentLines(message))
                .setAmend(true).setNoVerify(true).call();

        getRebaseFile(repository, MESSAGE_SQUASH).delete();
        getRebaseFile(repository, MESSAGE_FIXUP).delete();

        createFile(repository, MESSAGE, message);

        RebaseResult result = git.rebase()
                .setOperation(RebaseCommand.Operation.SKIP)
                .runInteractively(handler)
                .call();

        return new RebaseResponse(result);
    }
}
 
Example #11
Source File: WrapGit.java    From jphp with Apache License 2.0 6 votes vote down vote up
@Signature
public Memory resolveCommit(String revstr) throws IOException, GitAPIException {
    ObjectId objectId = getWrappedObject().getRepository().resolve(revstr);

    if (objectId == null) {
        return Memory.NULL;
    }

    LogCommand command = getWrappedObject()
            .log()
            .add(objectId)
            .setMaxCount(1);

    Iterable<RevCommit> call = command.call();

    for (RevCommit revCommit : call) {
        return GitUtils.valueOf(revCommit);
    }

    return Memory.NULL;
}
 
Example #12
Source File: GitHubNotebookRepo.java    From zeppelin with Apache License 2.0 6 votes vote down vote up
private void pullFromRemoteStream() {
  try {
    LOG.debug("Pulling latest changes from remote stream");
    PullCommand pullCommand = git.pull();
    pullCommand.setCredentialsProvider(
      new UsernamePasswordCredentialsProvider(
        zeppelinConfiguration.getZeppelinNotebookGitUsername(),
        zeppelinConfiguration.getZeppelinNotebookGitAccessToken()
      )
    );

    pullCommand.call();

  } catch (GitAPIException e) {
    LOG.error("Error when pulling latest changes from remote repository", e);
  }
}
 
Example #13
Source File: GitContentRepository.java    From studio with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void resetStagingRepository(String siteId) throws ServiceLayerException {
    Repository repo = helper.getRepository(siteId, PUBLISHED);
    String stagingName = servicesConfig.getStagingEnvironment(siteId);
    String liveName = servicesConfig.getLiveEnvironment(siteId);
    synchronized (repo) {
        try (Git git = new Git(repo)) {
            logger.debug("Checkout live first becuase it is not allowed to delete checkedout branch");
            git.checkout().setName(liveName).call();
            logger.debug("Delete staging branch in order to reset it for site: " + siteId);
            git.branchDelete().setBranchNames(stagingName).setForce(true).call();

            logger.debug("Create new branch for staging with live HEAD as starting point");
            git.branchCreate()
                    .setName(stagingName)
                    .setStartPoint(liveName)
                    .call();
        } catch (GitAPIException e) {
            logger.error("Error while reseting staging environment for site: " + siteId);
            throw new ServiceLayerException(e);
        }
    }
}
 
Example #14
Source File: ConfigRepository.java    From gocd with Apache License 2.0 6 votes vote down vote up
String getMergedConfig(String branchName, RevCommit newCommit) throws GitAPIException, IOException {
    MergeResult result = null;
    try {
        checkout(branchName);
        result = git.merge().include(newCommit).call();
    } catch (GitAPIException e) {
        LOGGER.info("[CONFIG_MERGE] Merging commit {} by user {} to branch {} at revision {} failed", newCommit.getId().getName(), newCommit.getAuthorIdent().getName(), branchName, getCurrentRevCommit().getId().getName());
        throw e;
    }
    if (!result.getMergeStatus().isSuccessful()) {
        LOGGER.info("[CONFIG_MERGE] Merging commit {} by user {} to branch {} at revision {} failed as config file has changed", newCommit.getId().getName(), newCommit.getAuthorIdent().getName(), branchName,
                getCurrentRevCommit().getId().getName());
        throw new ConfigFileHasChangedException();
    }
    LOGGER.info("[CONFIG_MERGE] Successfully merged commit {} by user {} to branch {}. Merge commit revision is {}", newCommit.getId().getName(), newCommit.getAuthorIdent().getName(), branchName, getCurrentRevCommit().getId().getName());
    return FileUtils.readFileToString(new File(workingDir, CRUISE_CONFIG_XML), UTF_8);
}
 
Example #15
Source File: UploadUtilTests.java    From super-cloudops with Apache License 2.0 6 votes vote down vote up
@Test
public void uploadTest() throws GitAPIException {
    Netty4ClientHttpRequestFactory factory = new Netty4ClientHttpRequestFactory();
    //factory.setConnectTimeout(10_000);
    //factory.setReadTimeout(60_000);
    //factory.setMaxResponseSize(1024 * 1024 * 10);
    RestTemplate restTemplate = new RestTemplate(factory);

    FileSystemResource resource = new FileSystemResource(new File("/Users/vjay/Downloads/logo.png"));
    MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
    param.add("deviceId", "123424");
    param.add("file", resource);
    String recv = restTemplate.postForObject(uploadUrl, param, String.class);
    System.out.println(recv);

    /*MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
    map.add("id",id);
    HttpHeaders header = new HttpHeaders();
    // 需求需要传参为form-data格式
    header.setContentType(MediaType.MULTIPART_FORM_DATA);
    HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(map, header);*/

}
 
Example #16
Source File: RepoMerger.java    From git-merge-repos with Apache License 2.0 5 votes vote down vote up
public List<MergedRef> run() throws IOException, GitAPIException {
	fetch();
	List<MergedRef> mergedBranches = mergeBranches();
	List<MergedRef> mergedTags = mergeTags();
	List<MergedRef> mergedRefs = new ArrayList<>();
	mergedRefs.addAll(mergedBranches);
	mergedRefs.addAll(mergedTags);
	deleteOriginalRefs();
	resetToBranch();
	return mergedRefs;
}
 
Example #17
Source File: TagBasedVersionFactoryTest.java    From gradle-gitsemver with Apache License 2.0 5 votes vote down vote up
@Test
public void testStableIsDirty() throws NoFilepatternException, IOException,
        GitAPIException {
    tag("0.1.0");
    dirtyRepo();
    Assert.assertEquals(
            "0.1.0+dirty",
            versionFactory.createVersion(repo, null).toString());
}
 
Example #18
Source File: JGitAPIImpl.java    From git-client-plugin with MIT License 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Map<String, ObjectId> getRemoteReferences(String url, String pattern, boolean headsOnly, boolean tagsOnly)
        throws GitException, InterruptedException {
    Map<String, ObjectId> references = new HashMap<>();
    String regexPattern = null;
    if (pattern != null) {
        regexPattern = createRefRegexFromGlob(pattern);
    }
    try (Repository repo = openDummyRepository()) {
        LsRemoteCommand lsRemote = new LsRemoteCommand(repo);
        if (headsOnly) {
            lsRemote.setHeads(headsOnly);
        }
        if (tagsOnly) {
            lsRemote.setTags(tagsOnly);
        }
        lsRemote.setRemote(url);
        lsRemote.setCredentialsProvider(getProvider());
        Collection<Ref> refs = lsRemote.call();
            for (final Ref r : refs) {
                final String refName = r.getName();
                final ObjectId refObjectId =
                        r.getPeeledObjectId() != null ? r.getPeeledObjectId() : r.getObjectId();
                if (regexPattern != null) {
                    if (refName.matches(regexPattern)) {
                        references.put(refName, refObjectId);
                    }
                } else {
                    references.put(refName, refObjectId);
                }
            }
    } catch (JGitInternalException | GitAPIException | IOException e) {
        throw new GitException(e);
    }
    return references;
}
 
Example #19
Source File: TagBasedVersionFactoryTest.java    From gradle-gitsemver with Apache License 2.0 5 votes vote down vote up
@Test
public void testHeadPointsAtCommitAboveStable() throws NoWorkTreeException,
        IOException, GitAPIException {
    tag("1.0.0");
    makeCommit();
    RevCommit commit = makeCommit();
    validateUnstable("1.0.0", 2, commit, Dirty.NO, DASH);
}
 
Example #20
Source File: CachedGoConfigIntegrationTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
public void writeFullConfigWithLockShouldUpdateReloadStrategyToEnsureReloadIsSkippedInAbsenceOfConfigFileChanges() throws GitAPIException, IOException {
    BasicCruiseConfig config = GoConfigMother.configWithPipelines("pipeline1");

    ConfigSaveState state = cachedGoConfig.writeFullConfigWithLock(new FullConfigUpdateCommand(config, goConfigService.configFileMd5()));

    String gitShaAfterSave = configRepository.getCurrentRevCommit().getName();
    assertThat(state).isEqualTo(ConfigSaveState.UPDATED);

    cachedGoConfig.forceReload();
    String gitShaAfterReload = configRepository.getCurrentRevCommit().getName();
    assertThat(gitShaAfterReload).isEqualTo(gitShaAfterSave);
}
 
Example #21
Source File: GitFXGsonUtil.java    From GitFx with Apache License 2.0 5 votes vote down vote up
public static void initializeGitRepository(String serverName,
            String projectName,String projectPath){
        try{
        File localPath = new File(projectPath);
        Git git;
                git = Git.init().setDirectory(localPath).call();
        git.close();
        }
        catch(GitAPIException e){
//[LOG]            logger.debug("Error creating Git repository",e.getMessage());
        }
    }
 
Example #22
Source File: GitProctorCore.java    From proctor with Apache License 2.0 5 votes vote down vote up
@Override
public void delete(final File testDefinitionDirectory) throws GitAPIException {
    for (final File file : testDefinitionDirectory.listFiles()) {
        git.rm().addFilepattern(testDefinitionsDirectory + "/" + testDefinitionDirectory.getName()
                + "/" + file.getName()).call();
    }
}
 
Example #23
Source File: GitMergeUtil.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
/**
 * {@code git fetch} {@code git reset --hard origin}
 */
private void revert() {
	try {
		repo.fetch().call();
		repo.reset().setMode(ResetType.HARD).setRef(mergeUnit.getBranchTarget()).call();
	} catch (GitAPIException e) {
		LOGGER.log(Level.SEVERE, String.format("Could no revert repository '%s'.", repoPath), e); //$NON-NLS-1$
	}
}
 
Example #24
Source File: AbstractSpringAcceptanceTests.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
public void checkoutReleaseTrainBranch(String fileToRepo, String branch)
		throws GitAPIException, URISyntaxException {
	File file = file(fileToRepo);
	Git git = GitTestUtils.openGitProject(file);
	git.reset().setMode(ResetCommand.ResetType.HARD).call();
	if (new File(file, ".travis.yml").exists()) {
		new File(file, ".travis.yml").delete();
	}
	git.checkout().setForce(true).setName(branch).call();
}
 
Example #25
Source File: GitMigrator.java    From rtc2gitcli with MIT License 5 votes vote down vote up
private void runGitGc() {
	try {
		git.gc().call();
	} catch (GitAPIException e) {
		e.printStackTrace();
	} finally {
		git.close();
	}
}
 
Example #26
Source File: TagMojo.java    From docker-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected void execute(DockerClient docker)
    throws MojoExecutionException, DockerException,
           IOException, InterruptedException, GitAPIException {

  if (skipDockerTag) {
    getLog().info("Skipping docker tag");
    return;
  }

  final String[] repoTag = parseImageName(newName);
  final String repo = repoTag[0];
  String tag = repoTag[1];

  if (useGitCommitId) {
    if (tag != null) {
      getLog().warn("Ignoring useGitCommitId flag because tag is explicitly set in image name ");
    } else {
      tag = new Git().getCommitId();
    }
  }

  final String normalizedName = isNullOrEmpty(tag) ? repo : String.format("%s:%s", repo, tag);
  getLog().info(String.format("Creating tag %s from %s", normalizedName, image));
  docker.tag(image, normalizedName, forceTags);

  final DockerBuildInformation buildInfo = new DockerBuildInformation(normalizedName, getLog());

  if (pushImage) {
    pushImage(docker, newName, null, getLog(), buildInfo, getRetryPushCount(),
        getRetryPushTimeout(), isSkipDockerPush());
  }

  writeImageInfoFile(buildInfo, tagInfoFile);
}
 
Example #27
Source File: UnchangedProjectsRemoverTest.java    From gitflow-incremental-builder with MIT License 5 votes vote down vote up
@Test
public void singleChanged_buildDownstream_enabled() throws GitAPIException, IOException {
    MavenProject changedModuleMock = addModuleMock(AID_MODULE_B, true);
    MavenProject dependentModuleMock = addModuleMock(AID_MODULE_B + "-dependent-jar", false);

    setUpstreamProjects(dependentModuleMock, changedModuleMock, moduleA);
    setDownstreamProjects(changedModuleMock, dependentModuleMock);

    // buildDownstream is enabled by default!

    underTest.act();

    verify(mavenSessionMock).setProjects(Arrays.asList(changedModuleMock, dependentModuleMock));
}
 
Example #28
Source File: GitProctorTest.java    From proctor with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetMatrix() throws StoreException, IOException, GitAPIException {
    final String revision1 =
            addTestDefinition("proc_tst", "author", "add a new test", DEFINITION_A);
    final String revision2 =
            addTestDefinition("proc_another_tst", "author", "add a another", DEFINITION_B);
    final String revision3 =
            deleteAllTestDefinitions("delete tests");

    assertThat(gitProctor.getTestMatrix(revision1).getTestMatrixDefinition().getTests())
            .hasSize(1)
            .containsEntry("proc_tst", DEFINITION_A);
    assertThat(gitProctor.getTestMatrix(revision1))
            .extracting(TestMatrixVersion::getAuthor, TestMatrixVersion::getDescription, TestMatrixVersion::getVersion)
            .containsExactly("author", "add a new test", revision1);

    assertThat(gitProctor.getTestMatrix(revision2).getTestMatrixDefinition().getTests())
            .hasSize(2)
            .containsEntry("proc_tst", DEFINITION_A)
            .containsEntry("proc_another_tst", DEFINITION_B);
    assertThat(gitProctor.getTestMatrix(revision2))
            .extracting(TestMatrixVersion::getAuthor, TestMatrixVersion::getDescription, TestMatrixVersion::getVersion)
            .containsExactly("author", "add a another", revision2);

    assertThat(gitProctor.getTestMatrix(revision3).getTestMatrixDefinition().getTests())
            .isEmpty();
    assertThat(gitProctor.getCurrentTestMatrix().getTestMatrixDefinition().getTests())
            .isEmpty();
    assertThat(gitProctor.getCurrentTestMatrix())
            .extracting(TestMatrixVersion::getDescription, TestMatrixVersion::getVersion)
            .containsExactly("delete tests", revision3);
}
 
Example #29
Source File: BuildListController.java    From Jpom with MIT License 5 votes vote down vote up
@RequestMapping(value = "branchList.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
public String branchList(
        @ValidatorConfig(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "仓库地址不正确")) String url,
        @ValidatorConfig(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "登录账号")) String userName,
        @ValidatorConfig(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "登录密码")) String userPwd) throws GitAPIException, IOException {
    List<String> list = GitUtil.getBranchList(url, userName, userPwd);
    return JsonMessage.getString(200, "ok", list);
}
 
Example #30
Source File: UnchangedProjectsRemoverTest.java    From gitflow-incremental-builder with MIT License 5 votes vote down vote up
@Test
public void nothingChanged_singleModule_withSubmodules_nonRecursive() throws GitAPIException, IOException {
    // note: a more realistic setup would require a proper parent/root
    moduleA.getModel().addModule("test");
    when(mavenExecutionRequestMock.isRecursive()).thenReturn(false);

    underTest.act();

    assertEquals(Collections.emptyList(), mavenSessionMock.getGoals(), "Unexpected goals");

    verify(mavenSessionMock, never()).setProjects(anyList());
    verify(moduleA).getModel();   // only once due to test setup

    assertProjectPropertiesEqual(moduleA, Collections.emptyMap());
}