Package org.tmatesoft.hg.repo

Examples of org.tmatesoft.hg.repo.HgManifest$RevisionMapper


  /**
   * @return never <code>null</code>. empty file if no changesets were written
   */
  public File create(List<Nodeid> changesets) throws HgIOException, IOException {
    final HgChangelog clog = repo.getRepo().getChangelog();
    final HgManifest manifest = repo.getRepo().getManifest();
    IntVector clogRevsVector = new IntVector(changesets.size(), 0);
    for (Nodeid n : changesets) {
      clogRevsVector.add(clog.getRevisionIndex(n));
    }
    clogRevsVector.sort(true);
    final int[] clogRevs = clogRevsVector.toArray();
    final IntMap<Nodeid> clogMap = new IntMap<Nodeid>(changesets.size());
    final IntVector manifestRevs = new IntVector(changesets.size(), 0);
    final List<HgDataFile> files = new ArrayList<HgDataFile>();
    clog.range(new HgChangelog.Inspector() {
      private Set<String> seenFiles = new HashSet<String>();
      public void next(int revisionIndex, Nodeid nodeid, RawChangeset cset) throws HgRuntimeException {
        clogMap.put(revisionIndex, nodeid);
        manifestRevs.add(manifest.getRevisionIndex(cset.manifest()));
        for (String f : cset.files()) {
          if (seenFiles.contains(f)) {
            continue;
          }
          seenFiles.add(f);
View Full Code Here


  public static void main2(String[] args) throws HgCallbackTargetException, HgException, CancelledException, HgRuntimeException {
    final HgRepository repository = new HgLookup().detect(new File("/temp/hg/cpython"));
    final Path targetPath = Path.create("README");
    final HgTags tags = repository.getTags();
    final Map<String, HgTags.TagInfo> tagToInfo = tags.getAllTags();
    final HgManifest manifest = repository.getManifest();
    final Map<Nodeid, List<String>> changeSetRevisionToTags = new HashMap<Nodeid, List<String>>();
    final HgDataFile fileNode = repository.getFileNode(targetPath);
    for (String tagName : tagToInfo.keySet()) {
      final HgTags.TagInfo info = tagToInfo.get(tagName);
      final Nodeid nodeId = info.revision();
      // TODO: This is not correct as we can't be sure that file at the corresponding revision is actually our target file (which may have been renamed, etc.)
      final Nodeid fileRevision = manifest.getFileRevision(repository.getChangelog().getRevisionIndex(nodeId), targetPath);
      if (fileRevision == null) {
        continue;
      }

      final Nodeid changeSetRevision = fileNode.getChangesetRevision(fileRevision);
View Full Code Here

    // TODO merge and HgMergeCommand
   
    errorCollector.assertEquals(2, hgRepo.getFileNode(fa).getRevisionCount());
    errorCollector.assertEquals(2, hgRepo.getFileNode(fb).getRevisionCount());
    errorCollector.assertEquals(2, hgRepo.getFileNode(fc).getRevisionCount());
    final HgManifest mf = hgRepo.getManifest();
    errorCollector.assertEquals(mf.getFileRevision(0, fa), mf.getFileRevision(3, fa)); // "A2" was reverted
  }
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.repo.HgManifest$RevisionMapper

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.