Merge "Clarify error msg when user's not allowed to '--force push'."
This commit is contained in:
		| @@ -15,6 +15,7 @@ | |||||||
| package com.google.gerrit.common.data; | package com.google.gerrit.common.data; | ||||||
|  |  | ||||||
| public class PermissionRule implements Comparable<PermissionRule> { | public class PermissionRule implements Comparable<PermissionRule> { | ||||||
|  |   public static final String FORCE_PUSH = "Force Push"; | ||||||
|   public static enum Action { |   public static enum Action { | ||||||
|     ALLOW, DENY, BLOCK, |     ALLOW, DENY, BLOCK, | ||||||
|  |  | ||||||
|   | |||||||
| @@ -137,6 +137,7 @@ public class PermissionRuleEditor extends Composite implements | |||||||
|       String ref = section.getName(); |       String ref = section.getName(); | ||||||
|       canForce = !ref.startsWith("refs/for/") && !ref.startsWith("^refs/for/"); |       canForce = !ref.startsWith("refs/for/") && !ref.startsWith("^refs/for/"); | ||||||
|     } |     } | ||||||
|  |     force.setText(PermissionRule.FORCE_PUSH); | ||||||
|     force.setVisible(canForce); |     force.setVisible(canForce); | ||||||
|     force.setEnabled(!readOnly); |     force.setEnabled(!readOnly); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -80,14 +80,7 @@ limitations under the License. | |||||||
|  |  | ||||||
|   <q:Hyperlink ui:field='groupNameLink' styleName='{style.groupName}'/> |   <q:Hyperlink ui:field='groupNameLink' styleName='{style.groupName}'/> | ||||||
|   <span ui:field='groupNameSpan' styleName='{style.groupName}'/> |   <span ui:field='groupNameSpan' styleName='{style.groupName}'/> | ||||||
|  |   <g:CheckBox ui:field='force' addStyleNames='{style.forcePush}'/> | ||||||
|   <g:CheckBox |  | ||||||
|       ui:field='force' |  | ||||||
|       addStyleNames='{style.forcePush}' |  | ||||||
|       text='Force Push'> |  | ||||||
|     <ui:attribute name='text'/> |  | ||||||
|   </g:CheckBox> |  | ||||||
|  |  | ||||||
|   <g:Anchor |   <g:Anchor | ||||||
|       ui:field='deleteRule' |       ui:field='deleteRule' | ||||||
|       href='javascript:void' |       href='javascript:void' | ||||||
|   | |||||||
| @@ -19,6 +19,7 @@ import com.google.gerrit.common.PageLinks; | |||||||
| import com.google.gerrit.common.data.ApprovalType; | import com.google.gerrit.common.data.ApprovalType; | ||||||
| import com.google.gerrit.common.data.ApprovalTypes; | import com.google.gerrit.common.data.ApprovalTypes; | ||||||
| import com.google.gerrit.common.data.Capable; | import com.google.gerrit.common.data.Capable; | ||||||
|  | import com.google.gerrit.common.data.PermissionRule; | ||||||
| import com.google.gerrit.common.errors.NoSuchAccountException; | import com.google.gerrit.common.errors.NoSuchAccountException; | ||||||
| import com.google.gerrit.reviewdb.Account; | import com.google.gerrit.reviewdb.Account; | ||||||
| import com.google.gerrit.reviewdb.ApprovalCategory; | import com.google.gerrit.reviewdb.ApprovalCategory; | ||||||
| @@ -597,7 +598,8 @@ public class ReceiveCommits implements PreReceiveHook, PostReceiveHook { | |||||||
|     if (ctl.canForceUpdate()) { |     if (ctl.canForceUpdate()) { | ||||||
|       // Let the core receive process handle it |       // Let the core receive process handle it | ||||||
|     } else { |     } else { | ||||||
|       cmd.setResult(ReceiveCommand.Result.REJECTED_NONFASTFORWARD); |       cmd.setResult(ReceiveCommand.Result.REJECTED_NONFASTFORWARD, " need '" | ||||||
|  |           + PermissionRule.FORCE_PUSH + "' privilege."); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Shawn Pearce
					Shawn Pearce