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

forge: make HostedCommit extend Commit #899

Closed
wants to merge 1 commit into from
Closed
Changes from all 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
@@ -29,61 +29,14 @@
import java.time.*;
import java.time.format.*;

public class HostedCommit {
private final CommitMetadata metadata;
private final List<Diff> parentDiffs;
public class HostedCommit extends Commit {
private final URI url;

public HostedCommit(CommitMetadata metadata, List<Diff> parentDiffs, URI url) {
this.metadata = metadata;
this.parentDiffs = parentDiffs;
super(metadata, parentDiffs);
this.url = url;
}

public Hash hash() {
return metadata.hash();
}

public Author author() {
return metadata.author();
}

public Author committer() {
return metadata.committer();
}

public List<String> message() {
return metadata.message();
}

public List<Hash> parents() {
return metadata.parents();
}

public ZonedDateTime authored() {
return metadata.authored();
}

public ZonedDateTime committed() {
return metadata.committed();
}

public boolean isInitialCommit() {
return metadata.isInitialCommit();
}

public boolean isMerge() {
return metadata.isMerge();
}

public int numParents() {
return metadata.numParents();
}

public List<Diff> parentDiffs() {
return parentDiffs;
}

public URI url() {
return url;
}
@@ -95,7 +48,7 @@ public String toString() {

@Override
public int hashCode() {
return Objects.hash(metadata, url);
return Objects.hash(url);
}

@Override
@@ -105,8 +58,6 @@ public boolean equals(Object o) {
}

var other = (HostedCommit) o;
return Objects.equals(metadata, other.metadata) &&
Objects.equals(parentDiffs, other.parentDiffs) &&
Objects.equals(url, other.url);
return Objects.equals(url, other.url);
}
}