Package org.tmatesoft.hg.core

Examples of org.tmatesoft.hg.core.Nodeid


      // commit new draft head
      new HgCheckoutCommand(srcRepo).changeset(publicCsetToBranchAt).clean(true).execute();
      RepoUtils.modifyFileAppend(f1, "// aaa");
      final HgCommitCommand commitCmd = new HgCommitCommand(srcRepo).message("Commit aaa");
      assertTrue(commitCmd.execute().isOk());
      final Nodeid newCommit = commitCmd.getCommittedRevision();
      //
      new HgPushCommand(srcRepo).destination(dstRemote).execute();
      // refresh phase information
      srcPhase = new PhasesHelper(HgInternals.getImplementationRepo(srcRepo));
      // r5 and r6 are changed to match server phases (more exposed)
View Full Code Here


      final HgRepository srcRepo = hgLookup.detect(srcRepoLoc);
      final HgRemoteRepository dstRemote = hgLookup.detect(server.getURL());
      new HgPushCommand(srcRepo).destination(dstRemote).execute();
      //
      // make sure pushed repository got same draft root
      final Nodeid r4PublicHead = srcRepo.getChangelog().getRevision(r4);
      final Nodeid r5DraftRoot = srcRepo.getChangelog().getRevision(r5);
      HgRepository dstRepo = hgLookup.detect(dstRepoLoc);
      final HgChangelog dstClog = dstRepo.getChangelog();
      PhasesHelper dstPhase = new PhasesHelper(HgInternals.getImplementationRepo(dstRepo));
      assertEquals(HgPhase.Public, dstPhase.getPhase(dstClog.getRevisionIndex(r4PublicHead), r4PublicHead));
      assertEquals(HgPhase.Draft, dstPhase.getPhase(dstClog.getRevisionIndex(r5DraftRoot), r5DraftRoot));
      //
      // now, graduate some local revisions, r5:draft->public, r6:secret->public, r9: secret->draft
      final ExecHelper srcRun = new ExecHelper(new OutputParser.Stub(), srcRepoLoc);
      srcRun.exec("hg", "phase", "--public", String.valueOf(r5));
      srcRun.exec("hg", "phase", "--public", String.valueOf(r6));
      srcRun.exec("hg", "phase", "--draft", String.valueOf(r9));
      // PhaseHelper shall be new for the command, and would pick up these external changes
      new HgPushCommand(srcRepo).destination(dstRemote).execute();
      final Nodeid r6Nodeid = srcRepo.getChangelog().getRevision(r6);
      final Nodeid r9Nodeid = srcRepo.getChangelog().getRevision(r9);
      // refresh
      dstPhase = new PhasesHelper(HgInternals.getImplementationRepo(dstRepo));
      // not errorCollector as subsequent code would fail if these secret revs didn't get into dst
      assertTrue(dstClog.isKnown(r6Nodeid));
      assertTrue(dstClog.isKnown(r9Nodeid));
View Full Code Here

  public boolean isChanged() throws HgRuntimeException {
    int rc = repo.getChangelog().getRevisionCount();
    if (rc != changelogRevCount) {
      return true;
    }
    Nodeid r = safeGetRevision(rc-1);
    return !r.equals(changelogLastRev);
  }
View Full Code Here

  }

  private void report(String what) throws Exception {
    final Map<Path, Nodeid> cmdLineResult = new LinkedHashMap<Path, Nodeid>(manifestParser.getResult());
    for (HgFileRevision fr : revisions) {
      Nodeid nid = cmdLineResult.remove(fr.getPath());
      errorCollector.checkThat("Extra " + fr.getPath() + " in Java result", nid, notNullValue());
      if (nid != null) {
        errorCollector.checkThat("Non-matching nodeid:" + nid, nid, equalTo(fr.getRevision()));
      }
    }
View Full Code Here

        continue;
      }
      try {
        assert spacePos == 40;
        final byte[] nodeidBytes = line.substring(0, spacePos).getBytes();
        Nodeid nid = Nodeid.fromAscii(nodeidBytes, 0, nodeidBytes.length);
        String tagName = line.substring(spacePos+1);
        List<Nodeid> nids = name2nid.get(tagName);
        if (nids == null) {
          nids = new LinkedList<Nodeid>();
          nids.add(nid);
          // tagName is substring of full line, thus need a copy to let the line be GC'ed
          // new String(tagName.toCharArray()) is more expressive, but results in 1 extra arraycopy
          tagName = new String(tagName);
          name2nid.put(tagName, nids);
        } else if (!nid.equals(nids.get(0))) {
          // Alternatively, !nids.contains(nid) might have come to mind.
          // However, I guess that 'tag history' means we need to record each change of revision
          // associated with the tag, i.e. imagine project evolution:
          // tag1=r1, tag1=r2, tag1=r1. If we choose !contains, list top of tag1 would point to r2
          // while we need it to point to r1.
View Full Code Here

      // FIXME replace HgParentChildMap with revlog.indexWalk(AncestorIterator))
      clogMap = new HgParentChildMap<HgChangelog>(repo.getChangelog());
      clogMap.init();
    }
    final HgRevisionMap<HgChangelog> m = clogMap.getRevisionMap();
    Nodeid ancestor = clogMap.ancestor(m.revision(fileParentClogRevs[0]), m.revision(fileParentClogRevs[1]));
    final int ancestorRevIndex = m.revisionIndex(ancestor);
    Nodeid fr = repo.getManifest().getFileRevision(ancestorRevIndex, targetFile.getPath());
    if (fr == null) {
      return LineSequence.newlines(new byte[0]);
    }
    return linesCache.lines(ancestorRevIndex, targetFile.getRevisionIndex(fr));
  }
View Full Code Here

  }

  private static Pair<Nodeid, Nodeid> internalReadParents(DataAccess da) throws IOException {
    byte[] parents = new byte[40];
    da.readBytes(parents, 0, 40);
    Nodeid n1 = Nodeid.fromBinary(parents, 0);
    Nodeid n2 = Nodeid.fromBinary(parents, 20);
    parents = null;
    return new Pair<Nodeid, Nodeid>(n1, n2);
  }
View Full Code Here

      assert inspector != null;
      insp = inspector;
    }
    @Override
    public void next(int revisionIndex, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) throws HgRuntimeException {
      Nodeid nid = getRevision(nodeid);
      insp.next(revisionIndex, nid, linkRevision);
      super.next(revisionIndex, actualLen, baseRevision, linkRevision, parent1Revision, parent2Revision, nodeid, data);
    }
View Full Code Here

        if (parent2RevIndex < start && parent2RevIndex >= 0) {
          missingParents.put(parent2RevIndex, null);
        }
      } else {
        // we iterate from the very beginning, got every index we'll need
        Nodeid p1 = parent1RevIndex == -1 ? Nodeid.NULL : allRevisions[parent1RevIndex];
        Nodeid p2 = parent2RevIndex == -1 ? Nodeid.NULL : allRevisions[parent2RevIndex];
        insp.next(revisionIndex, allRevisions[i], parent1RevIndex, parent2RevIndex, p1, p2);
      }
      i++;
      super.next(revisionIndex, actualLen, baseRevision, linkRevision, parent1RevIndex, parent2RevIndex, nodeid, data);
    }
View Full Code Here

        // it's possible to get empty missingParents when _start > 0 e.g. when n-th file revision
        // is a copy of another file and hence got -1,-1 parents in this revlog, and we indexWalk(n,n)
        for (int k = missingParents.firstKey(), l = missingParents.lastKey(); k <= l; k++) {
          // TODO [post-1.1] int[] IntMap#keys() or even sort of iterator that can modify values
          if (missingParents.containsKey(k)) {
            Nodeid nid = repo.getChangelog().getRevision(k);
            missingParents.put(k, nid);
          }
        }
      }

      for (int i = 0, revNum = start; i < allRevisions.length; i++, revNum++) {
        int riP1 = firstParentIndexes[i];
        int riP2 = secondParentIndexes[i];
        Nodeid p1, p2;
        p1 = p2 = Nodeid.NULL;
        if (riP1 >= start) {
          // p1 of revNum's revision is out of iterated range
          // (don't check for riP1<end as I assume parents come prior to children in the changelog)
          p1 = allRevisions[riP1 - start];
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.core.Nodeid

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.