Merge changes from topic 'no-changes-made'

* changes:
  Remove "no changes made" error case
  ApprovalCopier: Respect ChangeKind.NO_CHANGE in more cases
This commit is contained in:
Edwin Kempin 2016-02-10 08:13:26 +00:00 committed by Gerrit Code Review
commit 685b5b76cc
6 changed files with 63 additions and 40 deletions

View File

@ -256,10 +256,11 @@ applies if the patch set is a merge commit.
If true, all scores for the label are copied forward when a new
patch set is uploaded that is a new merge commit which only
differs from the previous patch set in its first parent. The
first parent would be the parent of the merge commit that is part
of the change's target branch, whereas the other parent(s) refer to
the feature branch(es) to be merged.
differs from the previous patch set in its first parent, or has
identical parents. The first parent would be the parent of the merge
commit that is part of the change's target branch, whereas the other
parent(s) refer to the feature branch(es) to be merged.
Defaults to false.
[[label_copyAllScoresOnTrivialRebase]]
@ -269,10 +270,13 @@ If true, all scores for the label are copied forward when a new patch
set is uploaded that is a trivial rebase. A new patch set is considered
as trivial rebase if the commit message is the same as in the previous
patch set and if it has the same code delta as the previous patch set.
This is the case if the change was rebased onto a different parent.
This is the case if the change was rebased onto a different parent, or
if the parent did not change at all.
This can be used to enable sticky approvals, reducing turn-around for
trivial rebases prior to submitting a change.
For the pre-installed Code-Review label this is enabled by default.
Defaults to false.
[[label_copyAllScoresIfNoCodeChange]]
@ -286,6 +290,7 @@ approvals on labels that only depend on the code, reducing turn-around
if only the commit message is changed prior to submitting a change.
For the Verified label that is installed by the link:pgm-init.html[init]
site program this is enabled by default.
Defaults to false.
[[label_copyAllScoresIfNoChange]]
@ -297,7 +302,9 @@ message as the previous patch set. This means that only the patch
set SHA1 is different. This can be used to enable sticky
approvals, reducing turn-around for this special case.
It is recommended to leave this enabled for both Verified and
Code-Review labels. Defaults to true.
Code-Review labels.
Defaults to true.
[[label_canOverride]]
=== `label.Label-Name.canOverride`

View File

@ -20,7 +20,6 @@ occurring and what can be done to solve it.
* link:error-missing-changeid.html[missing Change-Id in commit message footer]
* link:error-missing-subject.html[missing subject; Change-Id must be in commit message footer]
* link:error-multiple-changeid-lines.html[multiple Change-Id lines in commit message footer]
* link:error-no-changes-made.html[no changes made]
* link:error-no-common-ancestry.html[no common ancestry]
* link:error-no-new-changes.html[no new changes]
* link:error-non-fast-forward.html[non-fast forward]

View File

@ -1,23 +0,0 @@
= no changes made
With this error message Gerrit rejects to push a commit as a new
patch set for a change, if the pushed commit is identical to the
current patch set of this change.
A pushed commit is considered to be identical to the current patch
set if
- the files in the commit,
- the commit message,
- the author of the commit and
- the parents of the commit
are all identical.
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
SEARCHBOX
---------

View File

@ -133,6 +133,40 @@ public class LabelTypeIT extends AbstractDaemonTest {
assertApproval(patchSet, 0);
}
@Test
public void copyAllScoresIfNoCodeChangeAppliesToNoChange() throws Exception {
codeReview.setCopyAllScoresIfNoCodeChange(true);
codeReview.setCopyAllScoresIfNoChange(false);
saveLabelConfig();
PushOneCommit.Result patchSet = readyPatchSetForNoChangeRebase();
rebase(patchSet);
assertApproval(patchSet, 1);
}
@Test
public void copyAllScoresOnTrivialRebaseAppliesToNoChange() throws Exception {
codeReview.setCopyAllScoresOnTrivialRebase(true);
codeReview.setCopyAllScoresIfNoChange(false);
saveLabelConfig();
PushOneCommit.Result patchSet = readyPatchSetForNoChangeRebase();
rebase(patchSet);
assertApproval(patchSet, 1);
}
@Test
public void copyAllScoresOnMergeFirstParentUpdateAppliesToNoChange()
throws Exception {
codeReview.setCopyAllScoresOnMergeFirstParentUpdate(true);
codeReview.setCopyAllScoresIfNoChange(false);
saveLabelConfig();
PushOneCommit.Result patchSet = readyPatchSetForNoChangeRebase();
rebase(patchSet);
assertApproval(patchSet, 1);
}
@Test
public void copyAllScoresIfNoChange() throws Exception {
PushOneCommit.Result patchSet = readyPatchSetForNoChangeRebase();

View File

@ -16,10 +16,6 @@ package com.google.gerrit.server;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.gerrit.server.change.ChangeKind.MERGE_FIRST_PARENT_UPDATE;
import static com.google.gerrit.server.change.ChangeKind.NO_CHANGE;
import static com.google.gerrit.server.change.ChangeKind.NO_CODE_CHANGE;
import static com.google.gerrit.server.change.ChangeKind.TRIVIAL_REBASE;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.ListMultimap;
@ -173,10 +169,22 @@ public class ApprovalCopier {
// may not be psId.get() - 1).
return true;
}
return (type.isCopyAllScoresOnMergeFirstParentUpdate() && kind == MERGE_FIRST_PARENT_UPDATE)
|| (type.isCopyAllScoresOnTrivialRebase() && kind == TRIVIAL_REBASE)
|| (type.isCopyAllScoresIfNoCodeChange() && kind == NO_CODE_CHANGE)
|| (type.isCopyAllScoresIfNoChange() && kind == NO_CHANGE);
switch (kind) {
case MERGE_FIRST_PARENT_UPDATE:
return type.isCopyAllScoresOnMergeFirstParentUpdate();
case NO_CODE_CHANGE:
return type.isCopyAllScoresIfNoCodeChange();
case TRIVIAL_REBASE:
return type.isCopyAllScoresOnTrivialRebase();
case NO_CHANGE:
return type.isCopyAllScoresIfNoChange()
|| type.isCopyAllScoresOnTrivialRebase()
|| type.isCopyAllScoresOnMergeFirstParentUpdate()
|| type.isCopyAllScoresIfNoCodeChange();
case REWORK:
default:
return false;
}
}
private static PatchSetApproval copy(PatchSetApproval src, PatchSet.Id psId) {

View File

@ -2073,8 +2073,6 @@ public class ReceiveCommits {
"(W) No changes between prior commit %s and new commit %s",
reader.abbreviate(priorCommit).name(),
reader.abbreviate(newCommit).name()));
reject(inputCommand, "no changes made");
return false;
} else {
StringBuilder msg = new StringBuilder();
msg.append("(W) ");