Mercurial > jhg
comparison src/com/tmate/hgkit/console/Manifest.java @ 19:40532cdc92fc
Inspector (visitor) for manifest
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Tue, 04 Jan 2011 01:01:39 +0100 |
| parents | df8c67f3006a |
| children | 603806cd2dc6 |
comparison
equal
deleted
inserted
replaced
| 18:02ee376bee79 | 19:40532cdc92fc |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 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; | |
| 7 | |
| 6 import com.tmate.hgkit.fs.RepositoryLookup; | 8 import com.tmate.hgkit.fs.RepositoryLookup; |
| 9 import com.tmate.hgkit.ll.HgManifest; | |
| 7 import com.tmate.hgkit.ll.HgRepository; | 10 import com.tmate.hgkit.ll.HgRepository; |
| 11 import com.tmate.hgkit.ll.Nodeid; | |
| 8 | 12 |
| 9 /** | 13 /** |
| 10 * | 14 * |
| 11 * @author artem | 15 * @author artem |
| 12 */ | 16 */ |
| 19 if (hgRepo.isInvalid()) { | 23 if (hgRepo.isInvalid()) { |
| 20 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); | 24 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); |
| 21 return; | 25 return; |
| 22 } | 26 } |
| 23 System.out.println(hgRepo.getLocation()); | 27 System.out.println(hgRepo.getLocation()); |
| 24 hgRepo.getManifest().dump(); | 28 HgManifest.Inspector insp = new HgManifest.Inspector() { |
| 29 public boolean begin(int revision, Nodeid nid) { | |
| 30 System.out.printf("%d : %s\n", revision, nid); | |
| 31 return true; | |
| 32 } | |
| 33 | |
| 34 public boolean next(Nodeid nid, String fname, String flags) { | |
| 35 System.out.println(nid + "\t" + fname + "\t\t" + flags); | |
| 36 return true; | |
| 37 } | |
| 38 | |
| 39 public boolean end(int revision) { | |
| 40 System.out.println(); | |
| 41 return true; | |
| 42 } | |
| 43 }; | |
| 44 hgRepo.getManifest().walk(0, TIP, insp); | |
| 25 } | 45 } |
| 26 } | 46 } |
