Merge branch 'stable-2.16'

* stable-2.16:
  Update documentation of file modification types
  Admins should not be invited for review if proj. owners can update parent

Change-Id: Ibb8c47da06cdbda08bad60303cde607c59e318ea
This commit is contained in:
Edwin Kempin 2018-10-25 12:57:23 +02:00
commit a24708900e
2 changed files with 12 additions and 2 deletions

View File

@ -307,7 +307,7 @@ image::images/user-review-ui-change-screen-file-list-mark-as-reviewed.png[width=
The type of a file modification is indicated by the character in front The type of a file modification is indicated by the character in front
of the file name: of the file name:
- 'no character' (Modified): - `M` or 'no character' (Modified):
+ +
The file existed before this change and is modified. The file existed before this change and is modified.
@ -327,6 +327,10 @@ The file is renamed.
+ +
The file is new and is copied from an existing file. The file is new and is copied from an existing file.
- `U` (Unchanged):
+
The file is unchanged and has the same content.
image::images/user-review-ui-change-screen-file-list-modification-type.png[width=800, link="images/user-review-ui-change-screen-file-list-modification-type.png"] image::images/user-review-ui-change-screen-file-list-modification-type.png[width=800, link="images/user-review-ui-change-screen-file-list-modification-type.png"]
[[rename-or-copy]] [[rename-or-copy]]

View File

@ -34,6 +34,7 @@ import com.google.gerrit.server.account.GroupBackend;
import com.google.gerrit.server.change.ChangeInserter; import com.google.gerrit.server.change.ChangeInserter;
import com.google.gerrit.server.change.ChangeResource; import com.google.gerrit.server.change.ChangeResource;
import com.google.gerrit.server.config.AllProjectsName; import com.google.gerrit.server.config.AllProjectsName;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.git.meta.MetaDataUpdate; import com.google.gerrit.server.git.meta.MetaDataUpdate;
import com.google.gerrit.server.group.SystemGroupBackend; import com.google.gerrit.server.group.SystemGroupBackend;
import com.google.gerrit.server.permissions.PermissionBackend; import com.google.gerrit.server.permissions.PermissionBackend;
@ -56,6 +57,7 @@ import com.google.inject.assistedinject.Assisted;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import org.eclipse.jgit.errors.ConfigInvalidException; import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectInserter; import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.ObjectReader; import org.eclipse.jgit.lib.ObjectReader;
@ -80,6 +82,7 @@ public class ReviewProjectAccess extends ProjectAccessHandler<Change.Id> {
private final ChangesCollection changes; private final ChangesCollection changes;
private final ChangeInserter.Factory changeInserterFactory; private final ChangeInserter.Factory changeInserterFactory;
private final BatchUpdate.Factory updateFactory; private final BatchUpdate.Factory updateFactory;
private final boolean allowProjectOwnersToChangeParent;
@Inject @Inject
ReviewProjectAccess( ReviewProjectAccess(
@ -97,6 +100,7 @@ public class ReviewProjectAccess extends ProjectAccessHandler<Change.Id> {
Sequences seq, Sequences seq,
ContributorAgreementsChecker contributorAgreements, ContributorAgreementsChecker contributorAgreements,
Provider<CurrentUser> user, Provider<CurrentUser> user,
@GerritServerConfig Config config,
@Assisted("projectName") Project.NameKey projectName, @Assisted("projectName") Project.NameKey projectName,
@Nullable @Assisted ObjectId base, @Nullable @Assisted ObjectId base,
@Assisted List<AccessSection> sectionList, @Assisted List<AccessSection> sectionList,
@ -124,6 +128,8 @@ public class ReviewProjectAccess extends ProjectAccessHandler<Change.Id> {
this.changes = changes; this.changes = changes;
this.changeInserterFactory = changeInserterFactory; this.changeInserterFactory = changeInserterFactory;
this.updateFactory = updateFactory; this.updateFactory = updateFactory;
this.allowProjectOwnersToChangeParent =
config.getBoolean("receive", "allowProjectOwnersToChangeParent", false);
} }
// TODO(dborowitz): Hack MetaDataUpdate so it can be created within a BatchUpdate and we can avoid // TODO(dborowitz): Hack MetaDataUpdate so it can be created within a BatchUpdate and we can avoid
@ -178,7 +184,7 @@ public class ReviewProjectAccess extends ProjectAccessHandler<Change.Id> {
throw new IOException(e); throw new IOException(e);
} }
addProjectOwnersAsReviewers(rsrc); addProjectOwnersAsReviewers(rsrc);
if (parentProjectUpdate) { if (parentProjectUpdate && !allowProjectOwnersToChangeParent) {
addAdministratorsAsReviewers(rsrc); addAdministratorsAsReviewers(rsrc);
} }
return changeId; return changeId;