Make the --other-branches configurable

Introduce a branchOrder section in the project.config in order
to define a branch order and automate the back/forward porting
of changes.

For now assume only one branchOrder section. For example:

  [branchOrder]
    branch = master
    branch = stable-2.9
    branch = stable-2.8
    branch = stable-2.7

This format makes the ordering obvious (top-down) and complete: for any
two branches from the list the order is defined.

The --other-branches will rely on the branchOrder section in order to
find out a set of branches for which to check mergeability.  With the
above example, If a change is pushed to the master branch then the
--other-branches option will test mergeability into the stable-2.9,
stable-2.8 and stable-2.7 branches. If the changed would be pushed to
the stable-2.8 then the --other-branches option would test mergeability
only into the stable-2.7 branch.

Change-Id: Ib806d7e4b5702fa2d8effd197829b729cad95432
This commit is contained in:
Saša Živkov
2014-05-08 14:02:15 +02:00
parent 063f658042
commit 944b838d88
5 changed files with 138 additions and 5 deletions

View File

@@ -40,6 +40,7 @@ import com.google.gerrit.server.account.CapabilityCollection;
import com.google.gerrit.server.account.GroupMembership;
import com.google.gerrit.server.config.AllProjectsName;
import com.google.gerrit.server.config.SitePaths;
import com.google.gerrit.server.git.BranchOrderSection;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.git.ProjectConfig;
import com.google.gerrit.server.git.ProjectLevelConfig;
@@ -445,6 +446,16 @@ public class ProjectState {
return ImmutableList.copyOf(cls.values());
}
public BranchOrderSection getBranchOrderSection() {
for (ProjectState s : tree()) {
BranchOrderSection section = s.getConfig().getBranchOrderSection();
if (section != null) {
return section;
}
}
return null;
}
public ThemeInfo getTheme() {
ThemeInfo theme = this.theme;
if (theme == null) {