tikhomirov@1: /** tikhomirov@1: * Copyright (c) 2010 Artem Tikhomirov tikhomirov@1: */ tikhomirov@1: package com.tmate.hgkit.console; tikhomirov@1: tikhomirov@2: import com.tmate.hgkit.fs.RepositoryLookup; tikhomirov@2: import com.tmate.hgkit.ll.Changeset; tikhomirov@2: import com.tmate.hgkit.ll.HgDataFile; tikhomirov@1: import com.tmate.hgkit.ll.HgRepository; tikhomirov@1: tikhomirov@1: /** tikhomirov@1: * @author artem tikhomirov@1: */ tikhomirov@1: public class Log { tikhomirov@1: tikhomirov@1: public static void main(String[] args) throws Exception { tikhomirov@2: RepositoryLookup repoLookup = new RepositoryLookup(); tikhomirov@4: RepositoryLookup.Options cmdLineOpts = RepositoryLookup.Options.parse(args); tikhomirov@4: HgRepository hgRepo = repoLookup.detect(cmdLineOpts); tikhomirov@1: if (hgRepo.isInvalid()) { tikhomirov@1: System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); tikhomirov@1: return; tikhomirov@1: } tikhomirov@1: System.out.println(hgRepo.getLocation()); tikhomirov@3: final Changeset.Inspector callback = new Changeset.Inspector() { tikhomirov@2: tikhomirov@2: public void next(Changeset cset) { tikhomirov@3: System.out.println("==>"); tikhomirov@3: cset.dump(); tikhomirov@2: } tikhomirov@2: }; tikhomirov@4: for (String fname : cmdLineOpts.files) { tikhomirov@4: HgDataFile f1 = hgRepo.getFileNode(fname); tikhomirov@4: System.out.println("\nComplete of a file: " + fname); tikhomirov@4: f1.history(callback); tikhomirov@2: // tikhomirov@3: // System.out.println("\n\n========================="); tikhomirov@3: // System.out.println("Range 1-3:"); tikhomirov@3: // f1.history(1,3, callback); tikhomirov@4: } tikhomirov@3: // tikhomirov@3: System.out.println("\n\n========================="); tikhomirov@2: System.out.println("Complete of a repo:"); tikhomirov@2: hgRepo.getChangelog().all(callback); tikhomirov@1: //new ChangelogWalker().setFile("hello.c").setRevisionRange(1, 4).accept(new Visitor); tikhomirov@1: } tikhomirov@1: tikhomirov@1: }