Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SKARA-1194: Implement git webrev --no-comments option #1224

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -259,7 +259,7 @@ private static void generate(String[] args) throws IOException {
}
}

var noComments = arguments.contains("no-comments");
var comments = !arguments.contains("no-comments");

if (arguments.contains("base") && arguments.contains("rev")) {
System.err.println("error: cannot combine --base and --rev options");
@@ -451,7 +451,7 @@ private static void generate(String[] args) throws IOException {
.version(version)
.files(files)
.similarity(similarity)
.noComments(noComments)
.comments(comments)
.generate(base, head);
}
}
@@ -84,7 +84,7 @@ public static class Builder {
private String version;
private List<Path> files = List.of();
private int similarity = 90;
private boolean noComments;
private boolean comments;

Builder(ReadOnlyRepository repository, Path output) {
this.repository = repository;
@@ -163,8 +163,8 @@ public Builder similarity(int similarity) {
return this;
}

public Builder noComments(boolean noComments) {
this.noComments = noComments;
public Builder comments(boolean comments) {
this.comments = comments;
return this;
}

@@ -390,7 +390,7 @@ private void generate(Diff diff, Hash tailEnd, Hash head) throws IOException {
var path = status.isDeleted() ?
patch.source().path().get() :
patch.target().path().get();
var commits = noComments ? Collections.<CommitMetadata>emptyList() : repository.commitMetadata(tailEnd, headHash, List.of(path));
var commits = comments ? repository.commitMetadata(tailEnd, headHash, List.of(path)) : Collections.<CommitMetadata>emptyList();
if (status.isModified() || status.isRenamed() || status.isCopied()) {
var nav = navigations.removeFirst();
fileViews.add(new ModifiedFileView(repository, tailEnd, head, commits, formatter, patch, output, nav));