Package org.tmatesoft.hg.internal

Examples of org.tmatesoft.hg.internal.RepositoryComparator$BranchChain


  private RepositoryComparator getComparator(ProgressSupport ps, CancelSupport cs) throws HgRemoteConnectionException, CancelledException, HgRuntimeException {
    if (remoteRepo == null) {
      throw new IllegalArgumentException("Shall specify remote repository to compare against");
    }
    if (comparator == null) {
      comparator = new RepositoryComparator(getParentHelper(), remoteRepo);
      comparator.compare(ps, cs);
    }
    return comparator;
  }
View Full Code Here


  }

 
  private List<Nodeid> getOutgoingRevisions(ProgressSupport ps, CancelSupport cs) throws HgRemoteConnectionException, HgException, CancelledException {
    ps.start(10);
    final RepositoryComparator c = getComparator(new ProgressSupport.Sub(ps, 5), cs);
    List<Nodeid> local = c.getLocalOnlyRevisions();
    ps.worked(3);
    PhasesHelper phaseHelper = new PhasesHelper(Internals.getInstance(localRepo));
    if (phaseHelper.isCapableOfPhases() && phaseHelper.withSecretRoots()) {
      local = new RevisionSet(local).subtract(phaseHelper.allSecret()).asList();
    }
View Full Code Here

      progress.start(100);
      // TODO refactor same code in HgIncomingCommand #getComparator and #getParentHelper
      final HgChangelog clog = repo.getChangelog();
      final HgParentChildMap<HgChangelog> parentHelper = new HgParentChildMap<HgChangelog>(clog);
      parentHelper.init();
      final RepositoryComparator comparator = new RepositoryComparator(parentHelper, remote);
      // get incoming revisions
      comparator.compare(new ProgressSupport.Sub(progress, 50), getCancelSupport(null, true));
      final List<Nodeid> common = comparator.getCommon();
      // get bundle with changes from remote
      HgBundle incoming = remote.getChanges(common);
      //
      // add revisions to changelog, manifest, files
      final Internals implRepo = HgInternals.getImplementationRepo(repo);
View Full Code Here

   * @throws CancelledException if execution of the command was cancelled
   */
  public List<Nodeid> executeLite() throws HgException, CancelledException {
    try {
      LinkedHashSet<Nodeid> result = new LinkedHashSet<Nodeid>();
      RepositoryComparator repoCompare = getComparator();
      for (BranchChain bc : getMissingBranches()) {
        List<Nodeid> missing = repoCompare.visitBranches(bc);
        HashSet<Nodeid> common = new HashSet<Nodeid>(); // ordering is irrelevant 
        repoCompare.collectKnownRoots(bc, common);
        // missing could only start with common elements. Once non-common, rest is just distinct branch revision trails.
        for (Iterator<Nodeid> it = missing.iterator(); it.hasNext() && common.contains(it.next()); it.remove()) ;
        result.addAll(missing);
      }
      ArrayList<Nodeid> rv = new ArrayList<Nodeid>(result);
View Full Code Here

  private RepositoryComparator getComparator() throws CancelledException, HgRuntimeException {
    if (remoteRepo == null) {
      throw new IllegalArgumentException("Shall specify remote repository to compare against", null);
    }
    if (comparator == null) {
      comparator = new RepositoryComparator(getParentHelper(), remoteRepo);
//      comparator.compare(context); // XXX meanwhile we use distinct path to calculate common 
    }
    return comparator;
  }
View Full Code Here

  private List<Nodeid> getCommon() throws HgRemoteConnectionException, CancelledException, HgRuntimeException {
//    return getComparator(context).getCommon();
    final LinkedHashSet<Nodeid> common = new LinkedHashSet<Nodeid>();
    // XXX common can be obtained from repoCompare, but at the moment it would almost duplicate work of calculateMissingBranches
    // once I refactor latter, common shall be taken from repoCompare.
    RepositoryComparator repoCompare = getComparator();
    for (BranchChain bc : getMissingBranches()) {
      repoCompare.collectKnownRoots(bc, common);
    }
    return new LinkedList<Nodeid>(common);
  }
View Full Code Here

      final HgChangelog clog = repo.getChangelog();
      final HgParentChildMap<HgChangelog> parentHelper = new HgParentChildMap<HgChangelog>(clog);
      parentHelper.init();
      final Internals implRepo = HgInternals.getImplementationRepo(repo);
      final PhasesHelper phaseHelper = new PhasesHelper(implRepo, parentHelper);
      final RepositoryComparator comparator = new RepositoryComparator(parentHelper, remoteRepo);
      comparator.compare(new ProgressSupport.Sub(progress, 50), getCancelSupport(null, true));
      List<Nodeid> l = comparator.getLocalOnlyRevisions();
      if (phaseHelper.isCapableOfPhases() && phaseHelper.withSecretRoots()) {
        RevisionSet secret = phaseHelper.allSecret();
        outgoing = new RevisionSet(l).subtract(secret);
      } else {
        outgoing = new RevisionSet(l);
      }
      HgBundle b = null;
      if (!outgoing.isEmpty()) {
        //
        // prepare bundle
        BundleGenerator bg = new BundleGenerator(implRepo);
        File bundleFile = bg.create(outgoing.asList());
        progress.worked(20);
        b = new HgLookup(repo.getSessionContext()).loadBundle(bundleFile);
        //
        // send changes
        remoteRepo.unbundle(b, comparator.getRemoteHeads());
      } // update phase information nevertheless
      progress.worked(20);
      //
      // update phase information
      if (phaseHelper.isCapableOfPhases()) {
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.internal.RepositoryComparator$BranchChain

Copyright © 2018 www.massapicom. 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.