Remove support for refs/publish/
Support for drafts has been completely removed in Gerrit 2.15 (released in March 2018), and as a side effect refs/publish/ has become deprecated. Change Ifcd35dfdc (2017-10-09) introduced a deprecation warning. The last known script user of this feature (git-review) was migrated in https://review.openstack.org/#/c/584607/ , released in 1.27.1.0a1 Change-Id: Iac8adf5caf5186837ff11bcd0842b077a5fc33fb
This commit is contained in:
@@ -611,7 +611,6 @@ class ReceiveCommits {
|
|||||||
newProgress.end();
|
newProgress.end();
|
||||||
replaceProgress.end();
|
replaceProgress.end();
|
||||||
queueSuccessMessages(newChanges);
|
queueSuccessMessages(newChanges);
|
||||||
refsPublishDeprecationWarning();
|
|
||||||
|
|
||||||
logger.atFine().log(
|
logger.atFine().log(
|
||||||
"Command results: %s",
|
"Command results: %s",
|
||||||
@@ -619,13 +618,6 @@ class ReceiveCommits {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refsPublishDeprecationWarning() {
|
|
||||||
// TODO(xchangcheng): remove after migrating tools which are using this magic branch.
|
|
||||||
if (magicBranch != null && magicBranch.publish) {
|
|
||||||
addMessage("Pushing to refs/publish/* is deprecated, use refs/for/* instead.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendErrorMessages() {
|
private void sendErrorMessages() {
|
||||||
if (!errors.isEmpty()) {
|
if (!errors.isEmpty()) {
|
||||||
logger.atFine().log("Handling error conditions: %s", errors.keySet());
|
logger.atFine().log("Handling error conditions: %s", errors.keySet());
|
||||||
@@ -1362,8 +1354,6 @@ class ReceiveCommits {
|
|||||||
+ "for new changes and '--edit' for existing changes")
|
+ "for new changes and '--edit' for existing changes")
|
||||||
boolean draft;
|
boolean draft;
|
||||||
|
|
||||||
boolean publish;
|
|
||||||
|
|
||||||
@Option(name = "--private", usage = "mark new/updated change as private")
|
@Option(name = "--private", usage = "mark new/updated change as private")
|
||||||
boolean isPrivate;
|
boolean isPrivate;
|
||||||
|
|
||||||
@@ -1501,7 +1491,6 @@ class ReceiveCommits {
|
|||||||
this.deprecatedTopicSeen = false;
|
this.deprecatedTopicSeen = false;
|
||||||
this.cmd = cmd;
|
this.cmd = cmd;
|
||||||
this.draft = cmd.getRefName().startsWith(MagicBranch.NEW_DRAFT_CHANGE);
|
this.draft = cmd.getRefName().startsWith(MagicBranch.NEW_DRAFT_CHANGE);
|
||||||
this.publish = cmd.getRefName().startsWith(MagicBranch.NEW_PUBLISH_CHANGE);
|
|
||||||
this.labelTypes = labelTypes;
|
this.labelTypes = labelTypes;
|
||||||
this.notesMigration = notesMigration;
|
this.notesMigration = notesMigration;
|
||||||
GeneralPreferencesInfo prefs = user.state().getGeneralPreferences();
|
GeneralPreferencesInfo prefs = user.state().getGeneralPreferences();
|
||||||
|
|||||||
@@ -28,25 +28,19 @@ public final class MagicBranch {
|
|||||||
public static final String NEW_CHANGE = "refs/for/";
|
public static final String NEW_CHANGE = "refs/for/";
|
||||||
// TODO(xchangcheng): remove after 'repo' supports private/wip changes.
|
// TODO(xchangcheng): remove after 'repo' supports private/wip changes.
|
||||||
public static final String NEW_DRAFT_CHANGE = "refs/drafts/";
|
public static final String NEW_DRAFT_CHANGE = "refs/drafts/";
|
||||||
// TODO(xchangcheng): remove after migrating tools which are using this magic branch.
|
|
||||||
public static final String NEW_PUBLISH_CHANGE = "refs/publish/";
|
|
||||||
|
|
||||||
/** Extracts the destination from a ref name */
|
/** Extracts the destination from a ref name */
|
||||||
public static String getDestBranchName(String refName) {
|
public static String getDestBranchName(String refName) {
|
||||||
String magicBranch = NEW_CHANGE;
|
String magicBranch = NEW_CHANGE;
|
||||||
if (refName.startsWith(NEW_DRAFT_CHANGE)) {
|
if (refName.startsWith(NEW_DRAFT_CHANGE)) {
|
||||||
magicBranch = NEW_DRAFT_CHANGE;
|
magicBranch = NEW_DRAFT_CHANGE;
|
||||||
} else if (refName.startsWith(NEW_PUBLISH_CHANGE)) {
|
|
||||||
magicBranch = NEW_PUBLISH_CHANGE;
|
|
||||||
}
|
}
|
||||||
return refName.substring(magicBranch.length());
|
return refName.substring(magicBranch.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Checks if the supplied ref name is a magic branch */
|
/** Checks if the supplied ref name is a magic branch */
|
||||||
public static boolean isMagicBranch(String refName) {
|
public static boolean isMagicBranch(String refName) {
|
||||||
return refName.startsWith(NEW_DRAFT_CHANGE)
|
return refName.startsWith(NEW_DRAFT_CHANGE) || refName.startsWith(NEW_CHANGE);
|
||||||
|| refName.startsWith(NEW_PUBLISH_CHANGE)
|
|
||||||
|| refName.startsWith(NEW_CHANGE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the ref name prefix for a magic branch, {@code null} if the branch is not magic */
|
/** Returns the ref name prefix for a magic branch, {@code null} if the branch is not magic */
|
||||||
@@ -54,9 +48,6 @@ public final class MagicBranch {
|
|||||||
if (refName.startsWith(NEW_DRAFT_CHANGE)) {
|
if (refName.startsWith(NEW_DRAFT_CHANGE)) {
|
||||||
return NEW_DRAFT_CHANGE;
|
return NEW_DRAFT_CHANGE;
|
||||||
}
|
}
|
||||||
if (refName.startsWith(NEW_PUBLISH_CHANGE)) {
|
|
||||||
return NEW_PUBLISH_CHANGE;
|
|
||||||
}
|
|
||||||
if (refName.startsWith(NEW_CHANGE)) {
|
if (refName.startsWith(NEW_CHANGE)) {
|
||||||
return NEW_CHANGE;
|
return NEW_CHANGE;
|
||||||
}
|
}
|
||||||
@@ -80,11 +71,6 @@ public final class MagicBranch {
|
|||||||
if (result != Capable.OK) {
|
if (result != Capable.OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = checkMagicBranchRef(NEW_PUBLISH_CHANGE, repo, project);
|
|
||||||
if (result != Capable.OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Capable.OK;
|
return Capable.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2297,16 +2297,6 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
|||||||
.isEqualTo(Iterables.getLast(commits).name());
|
.isEqualTo(Iterables.getLast(commits).name());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void pushToPublishMagicBranchIsAllowed() throws Exception {
|
|
||||||
// Push to "refs/publish/*" will be a synonym of "refs/for/*".
|
|
||||||
createChange("refs/publish/master");
|
|
||||||
PushOneCommit.Result result = pushTo("refs/publish/master");
|
|
||||||
result.assertOkStatus();
|
|
||||||
assertThat(result.getMessage())
|
|
||||||
.endsWith("Pushing to refs/publish/* is deprecated, use refs/for/* instead.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void pushNoteDbRef() throws Exception {
|
public void pushNoteDbRef() throws Exception {
|
||||||
String ref = "refs/changes/34/1234/meta";
|
String ref = "refs/changes/34/1234/meta";
|
||||||
|
|||||||
Reference in New Issue
Block a user