Mercurial > jhg
comparison src/com/tmate/hgkit/console/Manifest.java @ 64:19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 21 Jan 2011 05:56:43 +0100 |
parents | 603806cd2dc6 |
children |
comparison
equal
deleted
inserted
replaced
63:a47530a2ea12 | 64:19e9e220bf68 |
---|---|
2 * Copyright (c) 2010, 2011 Artem Tikhomirov | 2 * Copyright (c) 2010, 2011 Artem Tikhomirov |
3 */ | 3 */ |
4 package com.tmate.hgkit.console; | 4 package com.tmate.hgkit.console; |
5 | 5 |
6 import static com.tmate.hgkit.ll.HgRepository.TIP; | 6 import static com.tmate.hgkit.ll.HgRepository.TIP; |
7 | |
8 import org.tmatesoft.hg.core.Path; | |
9 import org.tmatesoft.hg.core.RepositoryTreeWalker; | |
10 import org.tmatesoft.hg.core.LogCommand.FileRevision; | |
7 | 11 |
8 import com.tmate.hgkit.fs.RepositoryLookup; | 12 import com.tmate.hgkit.fs.RepositoryLookup; |
9 import com.tmate.hgkit.ll.HgManifest; | 13 import com.tmate.hgkit.ll.HgManifest; |
10 import com.tmate.hgkit.ll.HgRepository; | 14 import com.tmate.hgkit.ll.HgRepository; |
11 import com.tmate.hgkit.ll.Nodeid; | 15 import com.tmate.hgkit.ll.Nodeid; |
23 if (hgRepo.isInvalid()) { | 27 if (hgRepo.isInvalid()) { |
24 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); | 28 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); |
25 return; | 29 return; |
26 } | 30 } |
27 System.out.println(hgRepo.getLocation()); | 31 System.out.println(hgRepo.getLocation()); |
28 HgManifest.Inspector insp = new Dump(); | 32 hgRepo.getManifest().walk(0, TIP, new Dump()); |
29 hgRepo.getManifest().walk(0, TIP, insp); | 33 // |
34 new RepositoryTreeWalker(hgRepo).dirs(true).walk(new RepositoryTreeWalker.Handler() { | |
35 | |
36 public void begin(Nodeid manifestRevision) { | |
37 System.out.println(">> " + manifestRevision); | |
38 } | |
39 public void dir(Path p) { | |
40 System.out.println(p); | |
41 } | |
42 public void file(FileRevision fileRevision) { | |
43 System.out.print(fileRevision.getRevision());; | |
44 System.out.print(" "); | |
45 System.out.println(fileRevision.getPath()); | |
46 } | |
47 | |
48 public void end(Nodeid manifestRevision) { | |
49 System.out.println(); | |
50 } | |
51 }); | |
30 } | 52 } |
31 | 53 |
32 public static final class Dump implements HgManifest.Inspector { | 54 public static final class Dump implements HgManifest.Inspector { |
33 public boolean begin(int revision, Nodeid nid) { | 55 public boolean begin(int revision, Nodeid nid) { |
34 System.out.printf("%d : %s\n", revision, nid); | 56 System.out.printf("%d : %s\n", revision, nid); |