blob: 59fc5f296c42fae3bb11502b9098e9e7c66902f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
* https://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package org.eclipse.jgit.pgm;
import org.eclipse.jgit.revwalk.ObjectWalk;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevFlag;
import org.eclipse.jgit.revwalk.RevObject;
import org.eclipse.jgit.revwalk.RevTree;
@Command(usage = "usage_RevList")
class RevList extends RevWalkTextBuiltin {
@Override
protected void show(RevCommit c) throws Exception {
if (c.has(RevFlag.UNINTERESTING))
outw.print('-');
c.getId().copyTo(outbuffer, outw);
if (parents)
for (int i = 0; i < c.getParentCount(); i++) {
outw.print(' ');
c.getParent(i).getId().copyTo(outbuffer, outw);
}
outw.println();
}
@Override
protected void show(ObjectWalk ow, RevObject obj)
throws Exception {
if (obj.has(RevFlag.UNINTERESTING))
outw.print('-');
obj.getId().copyTo(outbuffer, outw);
final String path = ow.getPathString();
if (path != null) {
outw.print(' ');
outw.print(path);
} else if (obj instanceof RevTree)
outw.print(' ');
outw.println();
}
}
|