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

344: PR should warn when source branch is an upstream branch #555

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
@@ -24,7 +24,42 @@

import org.openjdk.skara.vcs.Hash;

public interface HostedBranch {
String name();
Hash hash();
import java.util.Objects;

public class HostedBranch {
private final String name;
private final Hash hash;

public HostedBranch(String name, Hash hash) {
this.name = name;
this.hash = hash;
}

public String name() {
return name;
}

public Hash hash() {
return hash;
}

@Override
public String toString() {
return name + "@" + hash.hex();
}

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

@Override
public boolean equals(Object other) {
if (!(other instanceof HostedBranch)) {
return false;
}

var o = (HostedBranch) other;
return Objects.equals(name, o.name) && Objects.equals(hash, o.hash);
}
}

This file was deleted.

@@ -247,7 +247,7 @@ public Hash branchHash(String ref) {
public List<HostedBranch> branches() {
var branches = request.get("branches").execute();
return branches.stream()
.map(b -> new GitHubBranch(b.get("name").asString(),
.map(b -> new HostedBranch(b.get("name").asString(),
new Hash(b.get("commit").get("sha").asString())))
.collect(Collectors.toList());
}

This file was deleted.

@@ -269,7 +269,7 @@ public Hash branchHash(String ref) {
public List<HostedBranch> branches() {
var branches = request.get("branches").execute();
return branches.stream()
.map(b -> new GitLabBranch(b.get("name").asString(),
.map(b -> new HostedBranch(b.get("name").asString(),
new Hash(b.get("commit").get("id").asString())))
.collect(Collectors.toList());
}

This file was deleted.

@@ -190,7 +190,7 @@ public List<HostedBranch> branches() {
try {
var result = new ArrayList<HostedBranch>();
for (var b : localRepository.branches()) {
result.add(new TestHostedBranch(b.name(), localRepository.resolve(b).orElseThrow()));
result.add(new HostedBranch(b.name(), localRepository.resolve(b).orElseThrow()));
}
return result;
} catch (IOException e) {