Merge branch 'stable-2.13'

* stable-2.13:
  WebLinks: Prevent NPE when file history weblink is null
  Unified: Set lineWrapping according to user preferences
  Print proper name for QuerySource tasks in show-queue command

Change-Id: I91a5fd545c4767acdaf3dd41b14b3f8db525e560
This commit is contained in:
Hugo Arès
2016-09-14 17:06:59 -04:00
3 changed files with 19 additions and 6 deletions

View File

@@ -236,7 +236,7 @@ public class Unified extends DiffScreen {
.set("inputStyle", "textarea")
.set("keyMap", "vim_ro")
.set("lineNumbers", false)
.set("lineWrapping", false)
.set("lineWrapping", prefs.lineWrapping())
.set("matchBrackets", prefs.matchBrackets())
.set("mode", getFileSize() == FileSize.SMALL ? getContentType(meta) : null)
.set("readOnly", true)

View File

@@ -252,7 +252,7 @@ public class LuceneChangeIndex implements ChangeIndex {
if (!Sets.intersection(statuses, CLOSED_STATUSES).isEmpty()) {
indexes.add(closedIndex);
}
return new QuerySource(indexes, queryBuilder.toQuery(p), opts, getSort());
return new QuerySource(indexes, p, opts, getSort());
}
@Override
@@ -274,14 +274,19 @@ public class LuceneChangeIndex implements ChangeIndex {
private class QuerySource implements ChangeDataSource {
private final List<ChangeSubIndex> indexes;
private final Predicate<ChangeData> predicate;
private final Query query;
private final QueryOptions opts;
private final Sort sort;
private QuerySource(List<ChangeSubIndex> indexes, Query query, QueryOptions opts,
Sort sort) {
private QuerySource(List<ChangeSubIndex> indexes,
Predicate<ChangeData> predicate, QueryOptions opts, Sort sort)
throws QueryParseException {
this.indexes = indexes;
this.query = checkNotNull(query, "null query from Lucene");
this.predicate = predicate;
this.query = checkNotNull(queryBuilder.toQuery(predicate),
"null query from Lucene");
this.opts = opts;
this.sort = sort;
}
@@ -298,7 +303,7 @@ public class LuceneChangeIndex implements ChangeIndex {
@Override
public String toString() {
return query.toString();
return predicate.toString();
}
@Override
@@ -315,6 +320,11 @@ public class LuceneChangeIndex implements ChangeIndex {
public List<Document> call() throws IOException {
return doRead(fields);
}
@Override
public String toString() {
return predicate.toString();
}
}), fields);
}

View File

@@ -159,6 +159,9 @@ public class WebLinks {
WebLinkInfo info =
((FileHistoryWebLink) webLink).getFileHistoryWebLink(project,
revision, file);
if (info == null) {
return null;
}
WebLinkInfoCommon commonInfo = new WebLinkInfoCommon();
commonInfo.name = info.name;
commonInfo.imageUrl = info.imageUrl;