Examples of FetchResult


Examples of org.eclipse.jgit.transport.FetchResult

          JGitText.get().missingConfigurationForKey, missingKey));
    }

    final boolean isRemote = !remote.equals(".");
    String remoteUri;
    FetchResult fetchRes;
    if (isRemote) {
      remoteUri = repoConfig.getString(
          ConfigConstants.CONFIG_REMOTE_SECTION, remote,
          ConfigConstants.CONFIG_KEY_URL);
      if (remoteUri == null) {
        String missingKey = ConfigConstants.CONFIG_REMOTE_SECTION + DOT
            + remote + DOT + ConfigConstants.CONFIG_KEY_URL;
        throw new InvalidConfigurationException(MessageFormat.format(
            JGitText.get().missingConfigurationForKey, missingKey));
      }

      if (monitor.isCancelled())
        throw new CanceledException(MessageFormat.format(
            JGitText.get().operationCanceled,
            JGitText.get().pullTaskName));

      FetchCommand fetch = new FetchCommand(repo);
      fetch.setRemote(remote);
      fetch.setProgressMonitor(monitor);
      configure(fetch);

      fetchRes = fetch.call();
    } else {
      // we can skip the fetch altogether
      remoteUri = "local repository";
      fetchRes = null;
    }

    monitor.update(1);

    if (monitor.isCancelled())
      throw new CanceledException(MessageFormat.format(
          JGitText.get().operationCanceled,
          JGitText.get().pullTaskName));

    // we check the updates to see which of the updated branches
    // corresponds
    // to the remote branch name
    AnyObjectId commitToMerge;
    if (isRemote) {
      Ref r = null;
      if (fetchRes != null) {
        r = fetchRes.getAdvertisedRef(remoteBranchName);
        if (r == null)
          r = fetchRes.getAdvertisedRef(Constants.R_HEADS
              + remoteBranchName);
      }
      if (r == null)
        throw new JGitInternalException(MessageFormat.format(JGitText
            .get().couldNotGetAdvertisedRef, remoteBranchName));
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchResult

        if (tagOption != null)
          transport.setTagOpt(tagOption);
        transport.setFetchThin(thin);
        configure(transport);

        FetchResult result = transport.fetch(monitor, refSpecs);
        return result;
      } finally {
        transport.close();
      }
    } catch (NoRemoteRepositoryException e) {
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchResult

      fetch.setDryRun(dryRun);
      fetch.setRemote(remote);
      fetch.setThin(thin);
      fetch.setProgressMonitor(new TextProgressMonitor());

      FetchResult result = fetch.call();
      return result;
   }
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchResult

   public static List<Ref> getRemoteBranches(final Git repo) throws GitAPIException
   {
      List<Ref> results = new ArrayList<Ref>();
      try
      {
         FetchResult fetch = repo.fetch().setRemote("origin").call();
         Collection<Ref> refs = fetch.getAdvertisedRefs();
         for (Ref ref : refs)
         {
            if (ref.getName().startsWith("refs/heads"))
            {
               results.add(ref);
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchResult

         final FileBasedConfig dstcfg = db.getConfig();
         dstcfg.setBoolean("core", null, "bare", false);
         dstcfg.save();

         saveRemote(uri);
         final FetchResult r = runFetch();
         final Ref branch = guessHEAD(r);
         doCheckout(branch);
      }
      catch (URISyntaxException e)
      {
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchResult

   private FetchResult runFetch() throws NotSupportedException,
            URISyntaxException, TransportException
   {
      final Transport tn = Transport.open(db, remoteName);
      final FetchResult r;
      try
      {
         tn.setTagOpt(TagOpt.FETCH_TAGS);
         r = tn.fetch(new TextProgressMonitor(), null);
      }
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchResult

      fetch.setDryRun(dryRun);
      fetch.setRemote(remote);
      fetch.setThin(thin);
      fetch.setProgressMonitor(new TextProgressMonitor());

      FetchResult result = fetch.call();
      return result;
   }
View Full Code Here

Examples of org.eweb4j.spiderman.fetcher.FetchResult

    fetcher.init(null);
    try {
      String url = "http://www.livingsocial.com/cities/1964-klang-valley-kuala-lumpur/deals/638602-patong-bay-resotel-return-flight?append_ref_code=source_cities_show";
      FetchRequest req = new FetchRequest();
      req.setUrl(url);
      FetchResult rs = fetcher.fetch(req);
      System.out.println(rs);
      System.out.println(rs.getPage().getContent());
    } catch (Exception e) {
      e.printStackTrace();
    }
//    String json = "{\"id\":12,\"name\":\"weiwei\"}";
//    Map<String, Object> map = CommonUtil.parse(json, Map.class);
View Full Code Here

Examples of org.eweb4j.spiderman.fetcher.FetchResult

      String url = task.url.replace(" ", "%20");
     
      FetchRequest req = new FetchRequest();
      req.setUrl(url);
     
      FetchResult fr = site.fetcher.fetch(req);
      return fr;
    }
//    return fetch();
  }
View Full Code Here

Examples of org.eweb4j.spiderman.fetcher.FetchResult

      return ;
    }
   
    FetchRequest req = new FetchRequest();
    req.setUrl(nextUrl);
    FetchResult fr = task.site.fetcher.fetch(req);
    if (fr == null || fr.getPage() == null)
      return ;
   
    //记录已经访问过该url,下次不要重复访问它
    visitedUrls.add(nextUrl);
   
    //解析nextPage
    Task nextTask = new Task(nextUrl, task.url, task.site, 0);
    Model nextModel = new Model();
    List<Field> isAlsoParseInNextPageFields = target.getModel().getIsAlsoParseInNextPageFields();
    if (isAlsoParseInNextPageFields == null || isAlsoParseInNextPageFields.isEmpty())
      return ;
   
    nextModel.getField().addAll(isAlsoParseInNextPageFields);
    tgt.setModel(nextModel);
   
    ModelParser parser = new ModelParser(nextTask, tgt, listener);
    Page nextPageResult = fr.getPage();
    List<Map<String, Object>> nextMaps = parser.parse(nextPageResult);
    if (nextMaps == null)
      return ;
   
    for (Map<String, Object> nextMap : nextMaps){
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.