RFR: Add topological merge bot

Erik Duveblad via github.com duke at openjdk.java.net
Thu Aug 29 13:14:00 UTC 2019


On Thu, 29 Aug 2019 12:28:41 GMT, Jorn Vernee via github.com <duke at openjdk.java.net> wrote:

> This PR adds a bot that does a topological merge of the branches in a repo.
> 
> The branches can declare a dependencies file, which lists the branches that they depend on. This bot will crawl the branches, collect the dependencies for each branch, and topologically sort them based on their dependencies. Following that it will attempt to merge each dependency into the dependent in this order (this is mainly done so that we get less merges/failures if one of the root merges fails).
> 
> Branches that do not declare a dependency file implicitly depend on the master branch. Therefore the list of branches that the bot considers is passed in during configuration.
> 
> ---
> 
> Aside from that, it also fixes a minor problem with `Repository::clone` on Windows.
> 
> ----------------
> 
> Commits:
>  - 4a8f3610:	Added top bot module
> 
> Pull request:
> https://git.openjdk.java.net/skara/pull/105
> 
> Webrev:
> https://webrevs.openjdk.java.net/skara/105/webrev.00
> 
> Patch:
> https://git.openjdk.java.net/skara/pull/105.diff
> 
> Fetch command:
> git fetch https://git.openjdk.java.net/skara pull/105/head:pull/105

bots/topological/src/main/java/org/openjdk/skara/bots/topological/TopologicalBot.java line 99:

> 98:                         Files.exists(depsFile) ? Files.readAllLines(depsFile) : List.of("master"));
> 99:                 List<String> failedMerges = new ArrayList<>();
> 100:                 boolean progress;

Isn't the format of the `deps.txt` file that the branches are separated with space? So maybe this should be:
```java
Set<String> parents = null;
if (Files.exists(depsFIle)) {
    var lines = Files.readAllLines(depsFile).stream().filter(String::isEmpty).collect(Collectors.toList());
    if (lines.size() > 1) {
        throw new IllegalStateException("Multiple non-empty lines in " + depsFile.toString() + ": " + String.join("\n", lines));
    }
    parents = new HashSet<>(Arrays.asList(lines.get(0).split(" ")));
} else {
    parents = Set.of("master");
}

PR: https://git.openjdk.java.net/skara/pull/105


More information about the skara-dev mailing list