comparison src/com/tmate/hgkit/console/Status.java @ 58:4cfc47bc14cc

Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 17 Jan 2011 23:01:19 +0100
parents 8b0d6f1bd6b4
children b771e94a4f7c
comparison
equal deleted inserted replaced
57:8b0d6f1bd6b4 58:4cfc47bc14cc
13 import com.tmate.hgkit.ll.HgDataFile; 13 import com.tmate.hgkit.ll.HgDataFile;
14 import com.tmate.hgkit.ll.HgRepository; 14 import com.tmate.hgkit.ll.HgRepository;
15 import com.tmate.hgkit.ll.LocalHgRepo; 15 import com.tmate.hgkit.ll.LocalHgRepo;
16 import com.tmate.hgkit.ll.Nodeid; 16 import com.tmate.hgkit.ll.Nodeid;
17 import com.tmate.hgkit.ll.StatusCollector; 17 import com.tmate.hgkit.ll.StatusCollector;
18 import com.tmate.hgkit.ll.WorkingCopyStatusCollector;
18 19
19 /** 20 /**
20 * 21 *
21 * @author artem 22 * @author artem
22 */ 23 */
47 sortAndPrint('R', r.getRemoved()); 48 sortAndPrint('R', r.getRemoved());
48 // 49 //
49 System.out.println("\n\nTry hg status --change <rev>:"); 50 System.out.println("\n\nTry hg status --change <rev>:");
50 sc.change(0, dump); 51 sc.change(0, dump);
51 System.out.println("\nStatus against working dir:"); 52 System.out.println("\nStatus against working dir:");
52 ((LocalHgRepo) hgRepo).statusLocal(TIP, dump); 53 WorkingCopyStatusCollector wcc = new WorkingCopyStatusCollector(hgRepo, ((LocalHgRepo) hgRepo).createWorkingDirWalker());
54 wcc.walk(TIP, dump);
53 System.out.println(); 55 System.out.println();
54 System.out.printf("Manifest of the revision %d:\n", r2); 56 System.out.printf("Manifest of the revision %d:\n", r2);
55 hgRepo.getManifest().walk(r2, r2, new Manifest.Dump()); 57 hgRepo.getManifest().walk(r2, r2, new Manifest.Dump());
56 System.out.println(); 58 System.out.println();
57 System.out.printf("\nStatus of working dir against %d:\n", r2); 59 System.out.printf("\nStatus of working dir against %d:\n", r2);
58 ((LocalHgRepo) hgRepo).statusLocal(r2, dump); 60 r = wcc.status(r2);
61 sortAndPrint('M', r.getModified());
62 sortAndPrint('A', r.getAdded());
63 sortAndPrint('R', r.getRemoved());
64 sortAndPrint('?', r.getUnknown());
65 sortAndPrint('I', r.getIgnored());
66 sortAndPrint('C', r.getClean());
67 sortAndPrint('!', r.getMissing());
59 } 68 }
60 69
61 private static void sortAndPrint(char prefix, List<String> ul) { 70 private static void sortAndPrint(char prefix, List<String> ul) {
62 ArrayList<String> sortList = new ArrayList<String>(ul); 71 ArrayList<String> sortList = new ArrayList<String>(ul);
63 Collections.sort(sortList); 72 Collections.sort(sortList);