1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.pgm;
12
13 import org.eclipse.jgit.revwalk.ObjectWalk;
14 import org.eclipse.jgit.revwalk.RevCommit;
15 import org.eclipse.jgit.revwalk.RevFlag;
16 import org.eclipse.jgit.revwalk.RevObject;
17 import org.eclipse.jgit.revwalk.RevTree;
18
19 @Command(usage = "usage_RevList")
20 class RevList extends RevWalkTextBuiltin {
21
22 @Override
23 protected void show(RevCommit c) throws Exception {
24 if (c.has(RevFlag.UNINTERESTING))
25 outw.print('-');
26 c.getId().copyTo(outbuffer, outw);
27 if (parents)
28 for (int i = 0; i < c.getParentCount(); i++) {
29 outw.print(' ');
30 c.getParent(i).getId().copyTo(outbuffer, outw);
31 }
32 outw.println();
33 }
34
35
36 @Override
37 protected void show(ObjectWalk ow, RevObject obj)
38 throws Exception {
39 if (obj.has(RevFlag.UNINTERESTING))
40 outw.print('-');
41 obj.getId().copyTo(outbuffer, outw);
42 final String path = ow.getPathString();
43 if (path != null) {
44 outw.print(' ');
45 outw.print(path);
46 } else if (obj instanceof RevTree)
47 outw.print(' ');
48 outw.println();
49
50 }
51 }