当前位置: 首页>>代码示例>>Java>>正文


Java TextProgressMonitor类代码示例

本文整理汇总了Java中org.eclipse.jgit.lib.TextProgressMonitor的典型用法代码示例。如果您正苦于以下问题:Java TextProgressMonitor类的具体用法?Java TextProgressMonitor怎么用?Java TextProgressMonitor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextProgressMonitor类属于org.eclipse.jgit.lib包,在下文中一共展示了TextProgressMonitor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: to

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
@Override
public void to(Path path) throws Git.Err {
	LOG.info(() -> String.format("Cloning %s into %s...", url, path.toString()));
	CloneCommand cloner = org.eclipse.jgit.api.Git.cloneRepository()
			.setURI(url)
			.setCredentialsProvider(new GitCredentialsProvider(
					CredentialHandlers.handlerMap()
			))
			.setProgressMonitor(
					enableOutput
							? new TextProgressMonitor()
							: NullProgressMonitor.INSTANCE
			)
			.setDirectory(path.toFile());
	branchName.ifPresent(cloner::setBranch);
	try {
		cloner.call();
	} catch (GitAPIException e) {
		throw new Git.Err(url, path.toString(), e);
	}
}
 
开发者ID:nyrkovalex,项目名称:get.me,代码行数:22,代码来源:GitCloneCommand.java

示例2: indexAll

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
@Override
public Result indexAll(ChangeIndex index) {
  ProgressMonitor pm = new TextProgressMonitor();
  pm.beginTask("Collecting projects", ProgressMonitor.UNKNOWN);
  SortedSet<ProjectHolder> projects = new TreeSet<>();
  int changeCount = 0;
  Stopwatch sw = Stopwatch.createStarted();
  for (Project.NameKey name : projectCache.all()) {
    try (Repository repo = repoManager.openRepository(name)) {
      long size = estimateSize(repo);
      changeCount += size;
      projects.add(new ProjectHolder(name, size));
    } catch (IOException e) {
      log.error("Error collecting projects", e);
      return new Result(sw, false, 0, 0);
    }
    pm.update(1);
  }
  pm.endTask();
  setTotalWork(changeCount);

  return indexAll(index, projects);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:24,代码来源:AllChangesIndexer.java

示例3: migrateData

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException {
  try {
    try (Repository repo = repoManager.openRepository(allUsersName)) {
      ProgressMonitor pm = new TextProgressMonitor();
      pm.beginTask("Collecting accounts", ProgressMonitor.UNKNOWN);
      Set<Account> accounts = scanAccounts(db, pm);
      pm.endTask();
      pm.beginTask("Migrating accounts to NoteDb", accounts.size());
      for (Account account : accounts) {
        updateAccountInNoteDb(repo, account);
        pm.update(1);
      }
      pm.endTask();
    }
  } catch (IOException | ConfigInvalidException e) {
    throw new OrmException("Migrating accounts to NoteDb failed", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:20,代码来源:Schema_154.java

示例4: migrateData

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException {
  try {
    try (Repository repo = repoManager.openRepository(allUsersName)) {
      ProgressMonitor pm = new TextProgressMonitor();
      pm.beginTask("Removing \"My Drafts\" menu items", ProgressMonitor.UNKNOWN);
      for (Account.Id id : (Iterable<Account.Id>) Accounts.readUserRefs(repo)::iterator) {
        if (removeMyDrafts(repo, id)) {
          pm.update(1);
        }
      }
      pm.endTask();
    }
  } catch (IOException | ConfigInvalidException e) {
    throw new OrmException("Removing \"My Drafts\" menu items failed", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:Schema_160.java

示例5: cloneRepository

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
public void cloneRepository() throws Exception {
	if (!passwordValidated) {
		this.getPassword();
	}
	if (isCloned()) {
		return;
	}
	ServerWizard2.LOGGER.info("Cloning " + this.remoteUrl + " into " + this.getRootDirectory().getAbsolutePath());
	cloned = false;
	try {
		//TODO: determine MacOS hang issue with the progress monitor
		//ProgressMonitor pim = new ProgressMonitor(null, "Cloning...", "", 0, 1);
		//GitProgressMonitor gpim = new GitProgressMonitor(pim);
		Git result = Git.cloneRepository()
				.setCredentialsProvider(credentials)
				.setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out)))
				.setURI(this.getRemoteUrl()).setDirectory(this.getRootDirectory()).call();

		cloned = true;
		result.close();
	} catch (Exception e1) {
		passwordValidated = false;
		this.betterError(e1);
	}
}
 
开发者ID:open-power,项目名称:serverwiz,代码行数:26,代码来源:GithubRepository.java

示例6: cloneRepo

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
private static boolean cloneRepo(TargetCommit cloneCommit, String customCommit) {
    CloneCommand cloneCommand = new CloneCommand()
            .setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out)))
            .setDirectory(new File(ROOT_DIR))
            .setURI("https://github.com/SpongePowered/SpongeVanilla.git")
            .setBranchesToClone(Collections.singleton("refs/heads/master"))
            .setBranch("refs/heads/master")
            .setCloneSubmodules(true);
    try {
        Git git = cloneCommand.call();
        
        if (cloneCommit == TargetCommit.CUSTOM) {
            git.checkout().setName(customCommit).call();
            
            git.submoduleInit().call();
            git.submoduleUpdate().setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))).call();
        }
        
        return true;
    } catch (GitAPIException e) {
        e.printStackTrace();
    }
    return false;
}
 
开发者ID:modwizcode,项目名称:VanillaBuild,代码行数:25,代码来源:VanillaBuildMain.java

示例7: gitClone

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
/**
 * Clone GIT repository from sourceforge.
 *
 * @param gitDirectory The directory of Git.
 */
private void gitClone(File gitDirectory) {
    try {
        git = Git.cloneRepository()
                .setDirectory(gitDirectory)
                .setURI("http://git.code.sf.net/p/neembuuuploader/gitcode")
                .setProgressMonitor(new TextProgressMonitor()).call();

        for (Ref f : git.branchList().setListMode(ListBranchCommand.ListMode.ALL).call()) {
            git.checkout().setName(f.getName()).call();
            System.out.println("checked out branch " + f.getName()
                    + ". HEAD: " + git.getRepository().getRef("HEAD"));
        }
        // try to checkout branches by specifying abbreviated names
        git.checkout().setName("master").call();
    } catch (GitAPIException | IOException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:Neembuu-Uploader,项目名称:neembuu-uploader,代码行数:24,代码来源:UpdaterGenerator.java

示例8: gitClone

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
/**
 * Clone GIT repository from sourceforge.
 *
 * @param gitDirectory The directory of Git.
 */
private void gitClone(File gitDirectory) {
    try {
        git = Git.cloneRepository()
                .setDirectory(gitDirectory)
                .setURI(env.gitURI())
                //.setURI("http://git.code.sf.net/p/neembuuuploader/gitcode")
                .setProgressMonitor(new TextProgressMonitor()).call();

        for (Ref f : git.branchList().setListMode(ListBranchCommand.ListMode.ALL).call()) {
            git.checkout().setName(f.getName()).call();
            System.out.println("checked out branch " + f.getName()
                    + ". HEAD: " + git.getRepository().getRef("HEAD"));
        }
        // try to checkout branches by specifying abbreviated names
        git.checkout().setName("master").call();
    } catch (GitAPIException | IOException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:Neembuu-Uploader,项目名称:neembuu-uploader,代码行数:25,代码来源:UpdaterGenerator.java

示例9: gitMonitor

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
private ProgressMonitor gitMonitor ( Writer w ) {
	return new TextProgressMonitor( w ) {

	};
	// return new ProgressMonitor() {
	//
	// @Override
	// public void update ( int completed ) {
	// // TODO Auto-generated method stub
	// logger.info( "items completed: {}", completed );
	// }
	//
	// @Override
	// public void start ( int totalTasks ) {
	// // TODO Auto-generated method stub
	//
	// }
	//
	// @Override
	// public boolean isCancelled () {
	// // TODO Auto-generated method stub
	// return false;
	// }
	//
	// @Override
	// public void endTask () {
	// // TODO Auto-generated method stub
	//
	// }
	//
	// @Override
	// public void beginTask ( String title, int totalWork ) {
	// // TODO Auto-generated method stub
	// logger.info( "progress: {}, items remaining: {}", title, totalWork );
	//
	// }
	// } ;
}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:39,代码来源:SourceControlManager.java

示例10: cloneNoCheckout

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
/**
 * In lieu of sparse checkout since it's not yet supported in JGit:
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=383772
 */
public void cloneNoCheckout(boolean withProgress) throws Exception {
    CloneCommand clone = Git.cloneRepository().setURI(repositoryUrl).setDirectory(localRepo.getDirectory().getParentFile()).setNoCheckout(true);
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=442029
    if (credentialsProvider != null)
        clone.setCredentialsProvider(credentialsProvider);
    if (withProgress)
        clone.setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out)));
    clone.call();
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:14,代码来源:VersionControlGit.java

示例11: clone

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
private Git clone(Pom pom, GitDependency dependency) throws MojoExecutionException {
	final CloneCommand c = new CloneCommand();
	final String location = dependency.getLocation();

	c.setURI(location);
	c.setCloneAllBranches(true);
	c.setProgressMonitor(new TextProgressMonitor());

	final GitDependencyHandler dependencyHandler = new GitDependencyHandler(dependency);
	final String version = dependencyHandler.getDependencyVersion(pom);
	final String tempDirectory = Directory.getTempDirectoryString(location, version);

	c.setDirectory(new File(tempDirectory));
	return c.call();
}
 
开发者ID:ejwa,项目名称:gitdep-maven-plugin,代码行数:16,代码来源:DownloaderMojo.java

示例12: pushAll

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
public void pushAll() throws GitAPIException {
    git.push()
            .setPushAll()
            .setProgressMonitor(new TextProgressMonitor())
            .setCredentialsProvider(new UsernamePasswordCredentialsProvider(GH_TOKEN, ""))
            .call();
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:8,代码来源:GHRule.java

示例13: commitFileToBranch

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
public void commitFileToBranch(String branch, String fileName, String content, String commitMessage)
        throws IOException, GitAPIException {
    final String beforeBranch = git.getRepository().getBranch();
    final List<Ref> refList = git.branchList().call();
    boolean exist = false;
    for (Ref ref : refList) {
        if (ref.getName().endsWith(branch)) {
            exist = true;
            break;
        }
    }
    if (!exist) {
        git.branchCreate().setName(branch).call();
    }

    git.checkout().setName(branch).call();

    writeStringToFile(new File(gitRootDir, fileName), content);
    git.add().addFilepattern(".").call();
    git.commit().setAll(true).setMessage(commitMessage).call();
    git.push()
            .setPushAll()
            .setProgressMonitor(new TextProgressMonitor())
            .setCredentialsProvider(new UsernamePasswordCredentialsProvider(GH_TOKEN, ""))
            .call();
    git.checkout().setName(beforeBranch).call();

    await().pollInterval(3, SECONDS)
            .timeout(120, SECONDS)
            .until(ghBranchAppeared(getGhRepo(), branch));
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:32,代码来源:GHRule.java

示例14: run

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
@Override
public int run() throws Exception {
  mustHaveValidSite();

  Injector dbInjector = createDbInjector(SINGLE_USER);
  manager.add(dbInjector);
  manager.start();
  RuntimeShutdown.add(manager::stop);
  dbInjector.injectMembers(this);

  ProgressMonitor progress = new TextProgressMonitor();
  progress.beginTask("Importing entities", ProgressMonitor.UNKNOWN);
  try (ReviewDb db = schemaFactory.open()) {
    for (RelationModel model : new JavaSchemaModel(ReviewDb.class).getRelations()) {
      relations.put(model.getRelationID(), Relation.create(model, db));
    }

    Parser<UnknownFieldSet> parser = UnknownFieldSet.getDefaultInstance().getParserForType();
    try (InputStream in = new BufferedInputStream(Files.newInputStream(file.toPath()))) {
      UnknownFieldSet msg;
      while ((msg = parser.parseDelimitedFrom(in)) != null) {
        Map.Entry<Integer, UnknownFieldSet.Field> e =
            Iterables.getOnlyElement(msg.asMap().entrySet());
        Relation rel =
            checkNotNull(
                relations.get(e.getKey()),
                "unknown relation ID %s in message: %s",
                e.getKey(),
                msg);
        List<ByteString> values = e.getValue().getLengthDelimitedList();
        checkState(values.size() == 1, "expected one string field in message: %s", msg);
        upsert(rel, values.get(0));
        progress.update(1);
      }
    }
    progress.endTask();
  }

  return 0;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:41,代码来源:ProtobufImport.java

示例15: indexAll

import org.eclipse.jgit.lib.TextProgressMonitor; //导入依赖的package包/类
@Override
public SiteIndexer.Result indexAll(final ProjectIndex index) {
  ProgressMonitor progress = new TextProgressMonitor(new PrintWriter(progressOut));
  progress.start(2);
  List<Project.NameKey> names = collectProjects(progress);
  return reindexProjects(index, names, progress);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:8,代码来源:AllProjectsIndexer.java


注:本文中的org.eclipse.jgit.lib.TextProgressMonitor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。