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@1: HgRepository hgRepo = repoLookup.detect(args); 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@2: final Changeset.Callback callback = new Changeset.Callback() { tikhomirov@2: tikhomirov@2: public void next(Changeset cset) { tikhomirov@2: System.out.println(); tikhomirov@2: } tikhomirov@2: }; tikhomirov@2: HgDataFile f1 = hgRepo.getFileNode("hello.c"); tikhomirov@2: System.out.println("Complete of a file:"); tikhomirov@2: f1.history(callback); tikhomirov@2: System.out.println("Range 1-3:"); tikhomirov@2: f1.history(1,3, callback); tikhomirov@2: // 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: }