comparison src/com/tmate/hgkit/console/Log.java @ 2:08db726a0fb7

Shaping out low-level Hg structures
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sun, 19 Dec 2010 05:41:31 +0100
parents a3576694a4d1
children 24bb4f365164
comparison
equal deleted inserted replaced
1:a3576694a4d1 2:08db726a0fb7
1 /** 1 /**
2 * Copyright (c) 2010 Artem Tikhomirov 2 * Copyright (c) 2010 Artem Tikhomirov
3 */ 3 */
4 package com.tmate.hgkit.console; 4 package com.tmate.hgkit.console;
5 5
6 import com.tmate.hgkit.fs.RepositoryFinder; 6 import com.tmate.hgkit.fs.RepositoryLookup;
7 import com.tmate.hgkit.ll.Changeset;
8 import com.tmate.hgkit.ll.HgDataFile;
7 import com.tmate.hgkit.ll.HgRepository; 9 import com.tmate.hgkit.ll.HgRepository;
8 10
9 /** 11 /**
10 * @author artem 12 * @author artem
11 */ 13 */
12 public class Log { 14 public class Log {
13 15
14 public static void main(String[] args) throws Exception { 16 public static void main(String[] args) throws Exception {
15 RepositoryFinder repoLookup = new RepositoryFinder(); 17 RepositoryLookup repoLookup = new RepositoryLookup();
16 HgRepository hgRepo = repoLookup.detect(args); 18 HgRepository hgRepo = repoLookup.detect(args);
17 if (hgRepo.isInvalid()) { 19 if (hgRepo.isInvalid()) {
18 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); 20 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation());
19 return; 21 return;
20 } 22 }
21 System.out.println(hgRepo.getLocation()); 23 System.out.println(hgRepo.getLocation());
24 final Changeset.Callback callback = new Changeset.Callback() {
25
26 public void next(Changeset cset) {
27 System.out.println();
28 }
29 };
30 HgDataFile f1 = hgRepo.getFileNode("hello.c");
31 System.out.println("Complete of a file:");
32 f1.history(callback);
33 System.out.println("Range 1-3:");
34 f1.history(1,3, callback);
35 //
36 System.out.println("Complete of a repo:");
37 hgRepo.getChangelog().all(callback);
22 //new ChangelogWalker().setFile("hello.c").setRevisionRange(1, 4).accept(new Visitor); 38 //new ChangelogWalker().setFile("hello.c").setRevisionRange(1, 4).accept(new Visitor);
23
24 } 39 }
25 40
26 } 41 }