summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Milanesio <luca.milanesio@gmail.com>2024-05-03 11:02:51 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-05-03 11:02:51 +0000
commit79a4366f4bf68ba19877c6b2cb612a5b49892501 (patch)
treeda5361f902405459e776a4b3f589bab789337941
parent89fd41e423df097aeacff7b62a6808bdb84583d4 (diff)
parent51371f8129bee54782570cbe06391d096477c0b5 (diff)
Merge "Merge branch 'stable-3.8' into stable-3.9" into stable-3.9
-rw-r--r--Documentation/cmd-index-changes.txt3
-rw-r--r--Documentation/config-gerrit.txt7
-rw-r--r--Documentation/rest-api-changes.txt6
-rw-r--r--java/com/google/gerrit/extensions/common/ChangeInfo.java2
-rw-r--r--java/com/google/gerrit/server/change/ChangeJson.java6
-rw-r--r--java/com/google/gerrit/server/git/ChangesByProjectCacheImpl.java7
6 files changed, 15 insertions, 16 deletions
diff --git a/Documentation/cmd-index-changes.txt b/Documentation/cmd-index-changes.txt
index 0ee7aabd26..1d4cbe342e 100644
--- a/Documentation/cmd-index-changes.txt
+++ b/Documentation/cmd-index-changes.txt
@@ -16,8 +16,7 @@ Changes can be specified in the link:rest-api-changes.html#change-id[same format
supported by the REST API.
== ACCESS
-Caller must have the 'Maintain Server' capability, or be the owner of the change
-to be indexed.
+Caller must have the 'Maintain Server' capability.
== SCRIPTING
This command is intended to be used in scripts.
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index fb5904bc81..dd7fa02db2 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -1596,13 +1596,6 @@ the change.
+
Default is true.
-[[change.showAssigneeInChangesTable]]change.showAssigneeInChangesTable::
-+
-Show assignee field in changes table. If set to false, assignees will
-not be visible in changes table.
-+
-Default is false.
-
[[change.strictLabels]]change.strictLabels::
+
Reject invalid label votes: invalid labels or invalid values. This
diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt
index df5566fe10..a56766e36f 100644
--- a/Documentation/rest-api-changes.txt
+++ b/Documentation/rest-api-changes.txt
@@ -7103,6 +7103,12 @@ the current change index doesn't have the data.
|`_number` ||
The change number. (The underscore is just a relict of a prior
attempt to deprecate the change number.)
+|`virtual_id_number` ||
+The virtual id number is globally unique. For local changes, it is equal to the
+`_number` attribute. For imported changes, the original `_number` is processed
+through a function designed to prevent conflicts with local change numbers.
+Note that its usage is intended solely for Gerrit's internals and UI, and
+adoption outside these scenarios is not advised.
|`owner` ||
The owner of the change as an link:rest-api-accounts.html#account-info[
AccountInfo] entity.
diff --git a/java/com/google/gerrit/extensions/common/ChangeInfo.java b/java/com/google/gerrit/extensions/common/ChangeInfo.java
index 69160e96ab..90c3a92051 100644
--- a/java/com/google/gerrit/extensions/common/ChangeInfo.java
+++ b/java/com/google/gerrit/extensions/common/ChangeInfo.java
@@ -102,7 +102,7 @@ public class ChangeInfo {
public Boolean containsGitConflicts;
public Integer _number;
- public Integer _virtualIdNumber;
+ public Integer virtualIdNumber;
public AccountInfo owner;
diff --git a/java/com/google/gerrit/server/change/ChangeJson.java b/java/com/google/gerrit/server/change/ChangeJson.java
index 2fce4755b5..1a9e4f8520 100644
--- a/java/com/google/gerrit/server/change/ChangeJson.java
+++ b/java/com/google/gerrit/server/change/ChangeJson.java
@@ -784,7 +784,7 @@ public class ChangeJson {
.collect(toList());
}
- out._virtualIdNumber = cd.virtualId().get();
+ out.virtualIdNumber = cd.virtualId().get();
return out;
}
@@ -977,7 +977,7 @@ public class ChangeJson {
// repository only once
try (Repository allUsersRepo = repoManager.openRepository(allUsers)) {
List<Change.Id> changeIds =
- changeInfos.stream().map(c -> Change.id(c._virtualIdNumber)).collect(Collectors.toList());
+ changeInfos.stream().map(c -> Change.id(c.virtualIdNumber)).collect(Collectors.toList());
Set<Change.Id> starredChanges =
starredChangesreader.areStarred(
allUsersRepo, changeIds, userProvider.get().asIdentifiedUser().getAccountId());
@@ -985,7 +985,7 @@ public class ChangeJson {
return;
}
changeInfos.stream()
- .forEach(c -> c.starred = starredChanges.contains(Change.id(c._virtualIdNumber)));
+ .forEach(c -> c.starred = starredChanges.contains(Change.id(c.virtualIdNumber)));
} catch (IOException e) {
logger.atWarning().withCause(e).log("Failed to open All-Users repo.");
}
diff --git a/java/com/google/gerrit/server/git/ChangesByProjectCacheImpl.java b/java/com/google/gerrit/server/git/ChangesByProjectCacheImpl.java
index 094287b7be..b5a53b2125 100644
--- a/java/com/google/gerrit/server/git/ChangesByProjectCacheImpl.java
+++ b/java/com/google/gerrit/server/git/ChangesByProjectCacheImpl.java
@@ -286,6 +286,7 @@ public class ChangesByProjectCacheImpl implements ChangesByProjectCache {
int size = 0;
size += JavaWeights.OBJECT; // change
size += JavaWeights.REFERENCE + GerritWeights.KEY_INT; // changeId
+ size += JavaWeights.REFERENCE + c.getServerId().length();
size += JavaWeights.REFERENCE + JavaWeights.OBJECT + 40; // changeKey;
size += JavaWeights.REFERENCE + GerritWeights.TIMESTAMP; // createdOn;
size += JavaWeights.REFERENCE + GerritWeights.TIMESTAMP; // lastUpdatedOn;
@@ -303,12 +304,12 @@ public class ChangesByProjectCacheImpl implements ChangesByProjectCache {
+ (c.getOriginalSubject().equals(c.getSubject()) ? 0 : c.getSubject().length());
size +=
JavaWeights.REFERENCE + (c.getSubmissionId() == null ? 0 : c.getSubmissionId().length());
- size += JavaWeights.REFERENCE + GerritWeights.ACCOUNT_ID; // assignee;
size += JavaWeights.REFERENCE + JavaWeights.BOOLEAN; // isPrivate;
size += JavaWeights.REFERENCE + JavaWeights.BOOLEAN; // workInProgress;
size += JavaWeights.REFERENCE + JavaWeights.BOOLEAN; // reviewStarted;
- size += JavaWeights.REFERENCE + GerritWeights.CHANGE_NUM; // revertOf;
- size += JavaWeights.REFERENCE + GerritWeights.PACTCH_SET_ID; // cherryPickOf;
+ size += JavaWeights.REFERENCE + (c.getRevertOf() == null ? 0 : GerritWeights.CHANGE_NUM);
+ size +=
+ JavaWeights.REFERENCE + (c.getCherryPickOf() == null ? 0 : GerritWeights.PACTCH_SET_ID);
return size;
}