Add user preference for auto-selecting a base for merges

For reviewing merge commits most users expect to the see the full diff
that is integrated by accepting the merge commit. This diff is
available if the user selects 'Parent 1' from the 'Diff against'
drop-down list, however this is a new feature and most users don't
know about. Also it is inconvenient to manually select the first
parent for every merge. To make this easier add a user preferences for
automatically selecting a base for merges. Let the default for this
new preference be 'First Parent', as this is what most users expect.

Change-Id: I633291f78fee7f9ce1feb73deb81f9312363b347
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-09-08 13:29:03 +02:00
parent 82cdfdf403
commit d540a257ed
10 changed files with 101 additions and 2 deletions

View File

@@ -83,6 +83,25 @@ public class GeneralPreferencesInfo {
DISABLED
}
public enum DefaultBase {
AUTO_MERGE(null),
FIRST_PARENT(-1);
private final String base;
DefaultBase(String base) {
this.base = base;
}
DefaultBase(int base) {
this(Integer.toString(base));
}
public String getBase() {
return base;
}
}
public enum TimeFormat {
/** 12-hour clock: 1:15 am, 2:13 pm */
HHMM_12("h:mm a"),
@@ -123,6 +142,7 @@ public class GeneralPreferencesInfo {
public List<MenuItem> my;
public Map<String, String> urlAliases;
public EmailStrategy emailStrategy;
public DefaultBase defaultBaseForMerges;
public boolean isShowInfoInReviewCategory() {
return getReviewCategoryStrategy() != ReviewCategoryStrategy.NONE;
@@ -180,6 +200,7 @@ public class GeneralPreferencesInfo {
p.legacycidInChangeTable = false;
p.muteCommonPathPrefixes = true;
p.signedOffBy = false;
p.defaultBaseForMerges = DefaultBase.FIRST_PARENT;
return p;
}
}