summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Daarstad <tomas.daarstad@tieto.com>2012-06-08 13:07:58 +0200
committerTomas Daarstad <tomas.daarstad@tieto.com>2012-06-11 13:25:04 +0200
commitf48ca3dedddf3c8b778c95b3d8e84861a9232ed0 (patch)
tree462e6853adb1f4a10010568b8c62d2cde9f7a05a
parent4f7126b04634a84ab89006880b2e2a8dd83cbdda (diff)
Fix for adding reviewers in push cmd in topicRC-QTQAINFRA-533-03
create only one ChangeSetApproval per topic Task-number: QTQAINFRA-533 Change-Id: If5c8fbb7970b639c0b7c55a18d1eb91535790a68
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
index 922a1fc7a2..157cff6807 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
@@ -1276,10 +1276,12 @@ public class ReceiveCommits implements PreReceiveHook, PostReceiveHook {
}
}
+ boolean createChangeSetApproval = true;
for (final RevCommit c : toCreate) {
try {
final int position = cOrder.indexOf(c) + toUpdate.size();
- createChange(walk, c, topicId, position);
+ createChange(walk, c, topicId, position, createChangeSetApproval);
+ createChangeSetApproval = false;
} catch (IOException e) {
log.error("Error computing patch of commit " + c.name(), e);
reject(newChange, "diff error");
@@ -1416,7 +1418,7 @@ public class ReceiveCommits implements PreReceiveHook, PostReceiveHook {
}
private void createChange(final RevWalk walk, final RevCommit c,
- final Topic.Id topicId, final int pos) throws OrmException, IOException {
+ final Topic.Id topicId, final int pos, boolean createChangeSetApproval) throws OrmException, IOException {
walk.parseBody(c);
warnMalformedMessage(c);
@@ -1488,14 +1490,14 @@ public class ReceiveCommits implements PreReceiveHook, PostReceiveHook {
allTypes.get(allTypes.size() - 1).getCategory().getId();
if (authorId != null && haveApprovals.add(authorId)) {
insertDummyApproval(change, ps.getId(), authorId, catId, db);
- if (topicId != null) {
+ if (topicId != null && createChangeSetApproval) {
insertDummyApproval(db.topics().get(topicId), db.topics()
.get(topicId).currentChangeSetId(), authorId, catId, db);
}
}
if (committerId != null && haveApprovals.add(committerId)) {
insertDummyApproval(change, ps.getId(), committerId, catId, db);
- if (topicId != null) {
+ if (topicId != null && createChangeSetApproval) {
insertDummyApproval(db.topics().get(topicId), db.topics()
.get(topicId).currentChangeSetId(), committerId, catId, db);
}
@@ -1503,7 +1505,7 @@ public class ReceiveCommits implements PreReceiveHook, PostReceiveHook {
for (final Account.Id reviewer : reviewers) {
if (haveApprovals.add(reviewer)) {
insertDummyApproval(change, ps.getId(), reviewer, catId, db);
- if (topicId != null) {
+ if (topicId != null && createChangeSetApproval) {
insertDummyApproval(db.topics().get(topicId),
db.topics().get(topicId).currentChangeSetId(), reviewer, catId,
db);