ReceiveCommits: remove support for deprecated topic syntax

This feature was deprecated in Ib2586b (Sep 25, 2018), which was
shipped in v2.16.

Change-Id: Ib2f06de0aacbc387e6c9f0925c9f8aa28e148fe0
This commit is contained in:
Han-Wen Nienhuys
2019-12-11 15:11:59 +01:00
parent 31640e5227
commit ab50321b61
9 changed files with 57 additions and 100 deletions

View File

@@ -1428,7 +1428,6 @@ class ReceiveCommits {
private final ProjectState projectState; private final ProjectState projectState;
private final boolean defaultPublishComments; private final boolean defaultPublishComments;
boolean deprecatedTopicSeen;
final ReceiveCommand cmd; final ReceiveCommand cmd;
final LabelTypes labelTypes; final LabelTypes labelTypes;
/** /**
@@ -1590,7 +1589,6 @@ class ReceiveCommits {
IdentifiedUser user, ProjectState projectState, ReceiveCommand cmd, LabelTypes labelTypes) { IdentifiedUser user, ProjectState projectState, ReceiveCommand cmd, LabelTypes labelTypes) {
this.user = user; this.user = user;
this.projectState = projectState; this.projectState = projectState;
this.deprecatedTopicSeen = false;
this.cmd = cmd; this.cmd = cmd;
this.labelTypes = labelTypes; this.labelTypes = labelTypes;
GeneralPreferencesInfo prefs = user.state().generalPreferences(); GeneralPreferencesInfo prefs = user.state().generalPreferences();
@@ -1678,28 +1676,7 @@ class ReceiveCommits {
if (!options.isEmpty()) { if (!options.isEmpty()) {
cmdLineParser.parseOptionMap(options); cmdLineParser.parseOptionMap(options);
} }
return ref;
// We accept refs/for/BRANCHNAME/TOPIC. Since we don't know
// for sure where the branch ends and the topic starts, look
// backward for a split that works. This behavior is deprecated.
String head = readHEAD(repo);
int split = ref.length();
for (; ; ) {
String name = ref.substring(0, split);
if (refCache.exactRef(name) != null || name.equals(head)) {
break;
}
split = name.lastIndexOf('/', split - 1);
if (split <= Constants.R_REFS.length()) {
return ref;
}
}
if (split < ref.length()) {
topic = Strings.emptyToNull(ref.substring(split + 1));
deprecatedTopicSeen = true;
}
return ref.substring(0, split);
} }
public boolean shouldSetWorkInProgressOnNewChanges() { public boolean shouldSetWorkInProgressOnNewChanges() {
@@ -1929,13 +1906,6 @@ class ReceiveCommits {
return; return;
} }
if (magicBranch.deprecatedTopicSeen) {
messages.add(
new ValidationMessage(
"WARNING: deprecated topic syntax. Use -o topic=TOPIC instead", false));
logger.atInfo().log("deprecated topic push seen for project %s", project.getName());
}
if (validateConnected(magicBranch.cmd, magicBranch.dest, tip)) { if (validateConnected(magicBranch.cmd, magicBranch.dest, tip)) {
this.magicBranch = magicBranch; this.magicBranch = magicBranch;
this.resultChangeIds.setMagicPush(true); this.resultChangeIds.setMagicPush(true);

View File

@@ -485,15 +485,9 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
@Test @Test
public void pushForMasterWithTopic() throws Exception { public void pushForMasterWithTopic() throws Exception {
// specify topic in ref
String topic = "my/topic"; String topic = "my/topic";
PushOneCommit.Result r = pushTo("refs/for/master/" + topic);
r.assertOkStatus();
r.assertChange(Change.Status.NEW, topic);
r.assertMessage("deprecated topic syntax");
// specify topic as option // specify topic as option
r = pushTo("refs/for/master%topic=" + topic); PushOneCommit.Result r = pushTo("refs/for/master%topic=" + topic);
r.assertOkStatus(); r.assertOkStatus();
r.assertChange(Change.Status.NEW, topic); r.assertChange(Change.Status.NEW, topic);
} }
@@ -514,14 +508,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
} }
@Test @Test
public void pushForMasterWithTopicInRefExceedLimitFails() throws Exception { public void pushForMasterWithTopicExceedLimitFails() throws Exception {
String topic = Stream.generate(() -> "t").limit(2049).collect(joining());
PushOneCommit.Result r = pushTo("refs/for/master/" + topic);
r.assertErrorStatus("topic length exceeds the limit (2048)");
}
@Test
public void pushForMasterWithTopicAsOptionExceedLimitFails() throws Exception {
String topic = Stream.generate(() -> "t").limit(2049).collect(joining()); String topic = Stream.generate(() -> "t").limit(2049).collect(joining());
PushOneCommit.Result r = pushTo("refs/for/master%topic=" + topic); PushOneCommit.Result r = pushTo("refs/for/master%topic=" + topic);
r.assertErrorStatus("topic length exceeds the limit (2048)"); r.assertErrorStatus("topic length exceeds the limit (2048)");
@@ -605,16 +592,16 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
public void pushForMasterWithCc() throws Exception { public void pushForMasterWithCc() throws Exception {
// cc one user // cc one user
String topic = "my/topic"; String topic = "my/topic";
PushOneCommit.Result r = pushTo("refs/for/master/" + topic + "%cc=" + user.email()); PushOneCommit.Result r = pushTo("refs/for/master%topic=" + topic + ",cc=" + user.email());
r.assertOkStatus(); r.assertOkStatus();
r.assertChange(Change.Status.NEW, topic, ImmutableList.of(), ImmutableList.of(user)); r.assertChange(Change.Status.NEW, topic, ImmutableList.of(), ImmutableList.of(user));
// cc several users // cc several users
r = r =
pushTo( pushTo(
"refs/for/master/" "refs/for/master%topic="
+ topic + topic
+ "%cc=" + ",cc="
+ admin.email() + admin.email()
+ ",cc=" + ",cc="
+ user.email() + user.email()
@@ -632,9 +619,9 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
String nonExistingEmail = "non.existing@example.com"; String nonExistingEmail = "non.existing@example.com";
r = r =
pushTo( pushTo(
"refs/for/master/" "refs/for/master%topic="
+ topic + topic
+ "%cc=" + ",cc="
+ admin.email() + admin.email()
+ ",cc=" + ",cc="
+ nonExistingEmail + nonExistingEmail
@@ -684,7 +671,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
public void pushForMasterWithReviewer() throws Exception { public void pushForMasterWithReviewer() throws Exception {
// add one reviewer // add one reviewer
String topic = "my/topic"; String topic = "my/topic";
PushOneCommit.Result r = pushTo("refs/for/master/" + topic + "%r=" + user.email()); PushOneCommit.Result r = pushTo("refs/for/master%topic=" + topic + ",r=" + user.email());
r.assertOkStatus(); r.assertOkStatus();
r.assertChange(Change.Status.NEW, topic, user); r.assertChange(Change.Status.NEW, topic, user);
@@ -693,9 +680,9 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
accountCreator.create("another-user", "another.user@example.com", "Another User"); accountCreator.create("another-user", "another.user@example.com", "Another User");
r = r =
pushTo( pushTo(
"refs/for/master/" "refs/for/master%topic="
+ topic + topic
+ "%r=" + ",r="
+ admin.email() + admin.email()
+ ",r=" + ",r="
+ user.email() + user.email()
@@ -709,9 +696,9 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
String nonExistingEmail = "non.existing@example.com"; String nonExistingEmail = "non.existing@example.com";
r = r =
pushTo( pushTo(
"refs/for/master/" "refs/for/master%topic="
+ topic + topic
+ "%r=" + ",r="
+ admin.email() + admin.email()
+ ",r=" + ",r="
+ nonExistingEmail + nonExistingEmail
@@ -942,7 +929,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
@Test @Test
public void pushForMasterWithMessage() throws Exception { public void pushForMasterWithMessage() throws Exception {
PushOneCommit.Result r = pushTo("refs/for/master/%m=my_test_message"); PushOneCommit.Result r = pushTo("refs/for/master%m=my_test_message");
r.assertOkStatus(); r.assertOkStatus();
r.assertChange(Change.Status.NEW, null); r.assertChange(Change.Status.NEW, null);
ChangeInfo ci = get(r.getChangeId(), MESSAGES, ALL_REVISIONS); ChangeInfo ci = get(r.getChangeId(), MESSAGES, ALL_REVISIONS);
@@ -966,7 +953,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
pushFactory.create(admin.newIdent(), testRepo, PushOneCommit.SUBJECT, "a.txt", "content"); pushFactory.create(admin.newIdent(), testRepo, PushOneCommit.SUBJECT, "a.txt", "content");
// %2C is comma; the value below tests that percent decoding happens after splitting. // %2C is comma; the value below tests that percent decoding happens after splitting.
// All three ways of representing space ("%20", "+", and "_" are also exercised. // All three ways of representing space ("%20", "+", and "_" are also exercised.
PushOneCommit.Result r = push.to("refs/for/master/%m=my_test%20+_message%2Cm="); PushOneCommit.Result r = push.to("refs/for/master%m=my_test%20+_message%2Cm=");
r.assertOkStatus(); r.assertOkStatus();
push = push =
@@ -977,7 +964,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
"b.txt", "b.txt",
"anotherContent", "anotherContent",
r.getChangeId()); r.getChangeId());
r = push.to("refs/for/master/%m=new_test_message"); r = push.to("refs/for/master%m=new_test_message");
r.assertOkStatus(); r.assertOkStatus();
ChangeInfo ci = get(r.getChangeId(), ALL_REVISIONS); ChangeInfo ci = get(r.getChangeId(), ALL_REVISIONS);
@@ -997,7 +984,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
// Exercise percent-encoding of UTF-8, underscores, and patterns reserved by git-rev-parse. // Exercise percent-encoding of UTF-8, underscores, and patterns reserved by git-rev-parse.
PushOneCommit.Result r = PushOneCommit.Result r =
pushTo( pushTo(
"refs/for/master/%m=" "refs/for/master%m="
+ "Punctu%2E%2e%2Eation%7E%2D%40%7Bu%7D%20%7C%20%28%E2%95%AF%C2%B0%E2%96%A1%C2%B0" + "Punctu%2E%2e%2Eation%7E%2D%40%7Bu%7D%20%7C%20%28%E2%95%AF%C2%B0%E2%96%A1%C2%B0"
+ "%EF%BC%89%E2%95%AF%EF%B8%B5%20%E2%94%BB%E2%94%81%E2%94%BB%20%5E%5F%5E"); + "%EF%BC%89%E2%95%AF%EF%B8%B5%20%E2%94%BB%E2%94%81%E2%94%BB%20%5E%5F%5E");
r.assertOkStatus(); r.assertOkStatus();
@@ -1018,7 +1005,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
@Test @Test
public void pushForMasterWithInvalidPercentEncodedMessage() throws Exception { public void pushForMasterWithInvalidPercentEncodedMessage() throws Exception {
PushOneCommit.Result r = pushTo("refs/for/master/%m=not_percent_decodable_%%oops%20"); PushOneCommit.Result r = pushTo("refs/for/master%m=not_percent_decodable_%%oops%20");
r.assertOkStatus(); r.assertOkStatus();
r.assertChange(Change.Status.NEW, null); r.assertChange(Change.Status.NEW, null);
ChangeInfo ci = get(r.getChangeId(), MESSAGES, ALL_REVISIONS); ChangeInfo ci = get(r.getChangeId(), MESSAGES, ALL_REVISIONS);
@@ -1036,7 +1023,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
@Test @Test
public void pushForMasterWithApprovals() throws Exception { public void pushForMasterWithApprovals() throws Exception {
PushOneCommit.Result r = pushTo("refs/for/master/%l=Code-Review"); PushOneCommit.Result r = pushTo("refs/for/master%l=Code-Review");
r.assertOkStatus(); r.assertOkStatus();
ChangeInfo ci = get(r.getChangeId(), DETAILED_LABELS, MESSAGES, DETAILED_ACCOUNTS); ChangeInfo ci = get(r.getChangeId(), DETAILED_LABELS, MESSAGES, DETAILED_ACCOUNTS);
LabelInfo cr = ci.labels.get("Code-Review"); LabelInfo cr = ci.labels.get("Code-Review");
@@ -1054,7 +1041,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
"b.txt", "b.txt",
"anotherContent", "anotherContent",
r.getChangeId()); r.getChangeId());
r = push.to("refs/for/master/%l=Code-Review+2"); r = push.to("refs/for/master%l=Code-Review+2");
ci = get(r.getChangeId(), DETAILED_LABELS, MESSAGES, DETAILED_ACCOUNTS); ci = get(r.getChangeId(), DETAILED_LABELS, MESSAGES, DETAILED_ACCOUNTS);
cr = ci.labels.get("Code-Review"); cr = ci.labels.get("Code-Review");
@@ -1075,7 +1062,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
"c.txt", "c.txt",
"moreContent", "moreContent",
r.getChangeId()); r.getChangeId());
r = push.to("refs/for/master/%l=Code-Review+2"); r = push.to("refs/for/master%l=Code-Review+2");
ci = get(r.getChangeId(), MESSAGES); ci = get(r.getChangeId(), MESSAGES);
assertThat(Iterables.getLast(ci.messages).message).isEqualTo("Uploaded patch set 3."); assertThat(Iterables.getLast(ci.messages).message).isEqualTo("Uploaded patch set 3.");
} }
@@ -1093,7 +1080,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
"b.txt", "b.txt",
"anotherContent", "anotherContent",
r.getChangeId()); r.getChangeId());
r = push.to("refs/for/master/%l=Code-Review+2"); r = push.to("refs/for/master%l=Code-Review+2");
ChangeInfo ci = get(r.getChangeId(), DETAILED_LABELS, MESSAGES, DETAILED_ACCOUNTS); ChangeInfo ci = get(r.getChangeId(), DETAILED_LABELS, MESSAGES, DETAILED_ACCOUNTS);
LabelInfo cr = ci.labels.get("Code-Review"); LabelInfo cr = ci.labels.get("Code-Review");
@@ -1180,7 +1167,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
.create(); .create();
// Push this commit as "Administrator" (requires Forge Committer Identity) // Push this commit as "Administrator" (requires Forge Committer Identity)
pushHead(testRepo, "refs/for/master/%l=Code-Review+1", false); pushHead(testRepo, "refs/for/master%l=Code-Review+1", false);
// Expected Code-Review votes: // Expected Code-Review votes:
// 1. 0 from User (committer): // 1. 0 from User (committer):
@@ -1228,7 +1215,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
.message(PushOneCommit.SUBJECT) .message(PushOneCommit.SUBJECT)
.create(); .create();
pushHead(testRepo, "refs/for/master/%l=Code-Review+1,l=Custom-Label-1", false); pushHead(testRepo, "refs/for/master%l=Code-Review+1,l=Custom-Label-1", false);
ChangeInfo ci = get(GitUtil.getChangeId(testRepo, c).get(), DETAILED_LABELS, DETAILED_ACCOUNTS); ChangeInfo ci = get(GitUtil.getChangeId(testRepo, c).get(), DETAILED_LABELS, DETAILED_ACCOUNTS);
LabelInfo cr = ci.labels.get("Code-Review"); LabelInfo cr = ci.labels.get("Code-Review");
@@ -1258,13 +1245,13 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
@Test @Test
public void pushForMasterWithApprovals_MissingLabel() throws Exception { public void pushForMasterWithApprovals_MissingLabel() throws Exception {
PushOneCommit.Result r = pushTo("refs/for/master/%l=Verify"); PushOneCommit.Result r = pushTo("refs/for/master%l=Verify");
r.assertErrorStatus("label \"Verify\" is not a configured label"); r.assertErrorStatus("label \"Verify\" is not a configured label");
} }
@Test @Test
public void pushForMasterWithApprovals_ValueOutOfRange() throws Exception { public void pushForMasterWithApprovals_ValueOutOfRange() throws Exception {
PushOneCommit.Result r = pushTo("refs/for/master/%l=Code-Review-3"); PushOneCommit.Result r = pushTo("refs/for/master%l=Code-Review-3");
r.assertErrorStatus("label \"Code-Review\": -3 is not a valid value"); r.assertErrorStatus("label \"Code-Review\": -3 is not a valid value");
} }
@@ -1297,7 +1284,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
"b.txt", "b.txt",
"anotherContent", "anotherContent",
r.getChangeId()); r.getChangeId());
r = push.to("refs/for/master/%hashtag=" + hashtag2); r = push.to("refs/for/master%hashtag=" + hashtag2);
r.assertOkStatus(); r.assertOkStatus();
expected = ImmutableSet.of(hashtag1, hashtag2); expected = ImmutableSet.of(hashtag1, hashtag2);
hashtags = gApi.changes().id(r.getChangeId()).getHashtags(); hashtags = gApi.changes().id(r.getChangeId()).getHashtags();

View File

@@ -139,7 +139,7 @@ public abstract class AbstractSubmoduleSubscription extends AbstractDaemonTest {
String pushedRef = ref; String pushedRef = ref;
if (!topic.isEmpty()) { if (!topic.isEmpty()) {
pushedRef += "/" + name(topic); pushedRef += "%topic=" + name(topic);
} }
String refspec = "HEAD:" + pushedRef; String refspec = "HEAD:" + pushedRef;

View File

@@ -565,7 +565,7 @@ public class SubmoduleSubscriptionsIT extends AbstractSubmoduleSubscription {
// Create change as user. // Create change as user.
PushOneCommit push = PushOneCommit push =
pushFactory.create(user.newIdent(), repo2, "Change 2", "b.txt", "other content"); pushFactory.create(user.newIdent(), repo2, "Change 2", "b.txt", "other content");
PushOneCommit.Result pushResult2 = push.to("refs/for/master/" + name(topic)); PushOneCommit.Result pushResult2 = push.to("refs/for/master%topic=" + name(topic));
approve(pushResult2.getChangeId()); approve(pushResult2.getChangeId());
// Submit the topic, 2 changes with the different author. // Submit the topic, 2 changes with the different author.

View File

@@ -109,7 +109,7 @@ public class SubmoduleSubscriptionsWholeTopicMergeIT extends AbstractSubmoduleSu
.git() .git()
.push() .push()
.setRemote("origin") .setRemote("origin")
.setRefSpecs(new RefSpec("HEAD:refs/for/master/" + name("topic-foo"))) .setRefSpecs(new RefSpec("HEAD:refs/for/master%topic=" + name("topic-foo")))
.call(); .call();
subRepo.reset(c.getId()); subRepo.reset(c.getId());
@@ -134,7 +134,7 @@ public class SubmoduleSubscriptionsWholeTopicMergeIT extends AbstractSubmoduleSu
.git() .git()
.push() .push()
.setRemote("origin") .setRemote("origin")
.setRefSpecs(new RefSpec("HEAD:refs/for/master/" + name("topic-foo"))) .setRefSpecs(new RefSpec("HEAD:refs/for/master%topic=" + name("topic-foo")))
.call(); .call();
String id1 = getChangeId(subRepo, c1).get(); String id1 = getChangeId(subRepo, c1).get();
@@ -212,7 +212,7 @@ public class SubmoduleSubscriptionsWholeTopicMergeIT extends AbstractSubmoduleSu
.git() .git()
.push() .push()
.setRemote("origin") .setRemote("origin")
.setRefSpecs(new RefSpec("HEAD:refs/for/master/" + name("topic-foo"))) .setRefSpecs(new RefSpec("HEAD:refs/for/master%topic=" + name("topic-foo")))
.call(); .call();
subRepo.reset(c.getId()); subRepo.reset(c.getId());
@@ -237,7 +237,7 @@ public class SubmoduleSubscriptionsWholeTopicMergeIT extends AbstractSubmoduleSu
.git() .git()
.push() .push()
.setRemote("origin") .setRemote("origin")
.setRefSpecs(new RefSpec("HEAD:refs/for/master/" + name("topic-foo"))) .setRefSpecs(new RefSpec("HEAD:refs/for/master%topic=" + name("topic-foo")))
.call(); .call();
RevCommit c4 = RevCommit c4 =
@@ -252,7 +252,7 @@ public class SubmoduleSubscriptionsWholeTopicMergeIT extends AbstractSubmoduleSu
.git() .git()
.push() .push()
.setRemote("origin") .setRemote("origin")
.setRefSpecs(new RefSpec("HEAD:refs/for/master/" + name("topic-foo"))) .setRefSpecs(new RefSpec("HEAD:refs/for/master%topic=" + name("topic-foo")))
.call(); .call();
String id1 = getChangeId(subRepo, c1).get(); String id1 = getChangeId(subRepo, c1).get();

View File

@@ -614,11 +614,11 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
@Test @Test
public void submitWithHiddenBranchInSameTopic() throws Throwable { public void submitWithHiddenBranchInSameTopic() throws Throwable {
assume().that(isSubmitWholeTopicEnabled()).isTrue(); assume().that(isSubmitWholeTopicEnabled()).isTrue();
PushOneCommit.Result visible = createChange("refs/for/master/" + name("topic")); PushOneCommit.Result visible = createChange("refs/for/master%topic=" + name("topic"));
Change.Id num = visible.getChange().getId(); Change.Id num = visible.getChange().getId();
createBranch(BranchNameKey.create(project, "hidden")); createBranch(BranchNameKey.create(project, "hidden"));
PushOneCommit.Result hidden = createChange("refs/for/hidden/" + name("topic")); PushOneCommit.Result hidden = createChange("refs/for/hidden%topic=" + name("topic"));
approve(hidden.getChangeId()); approve(hidden.getChangeId());
projectOperations projectOperations
.project(project) .project(project)
@@ -789,8 +789,8 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
// create and submit 2 changes with the same topic // create and submit 2 changes with the same topic
String topic = name("topic"); String topic = name("topic");
PushOneCommit.Result change1 = createChange("refs/for/master/" + topic); PushOneCommit.Result change1 = createChange("refs/for/master%topic=" + topic);
PushOneCommit.Result change2 = createChange("refs/for/master/" + topic); PushOneCommit.Result change2 = createChange("refs/for/master%topic=" + topic);
approve(change1.getChangeId()); approve(change1.getChangeId());
submit(change2.getChangeId()); submit(change2.getChangeId());
assertMerged(change1.getChangeId()); assertMerged(change1.getChangeId());
@@ -938,7 +938,7 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
testRepo testRepo
.git() .git()
.push() .push()
.setRefSpecs(new RefSpec("refs/heads/stable:refs/for/stable/" + name("topic"))) .setRefSpecs(new RefSpec("refs/heads/stable:refs/for/stable%topic=" + name("topic")))
.call(); .call();
// Merge the fix into master. // Merge the fix into master.
@@ -955,7 +955,7 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
testRepo testRepo
.git() .git()
.push() .push()
.setRefSpecs(new RefSpec("refs/heads/master:refs/for/master/" + name("topic"))) .setRefSpecs(new RefSpec("refs/heads/master:refs/for/master%topic=" + name("topic")))
.call(); .call();
// Submit together. // Submit together.
@@ -1475,6 +1475,6 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
protected PushOneCommit.Result createChange( protected PushOneCommit.Result createChange(
String subject, String fileName, String content, String topic) throws Throwable { String subject, String fileName, String content, String topic) throws Throwable {
PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo, subject, fileName, content); PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo, subject, fileName, content);
return push.to("refs/for/master/" + name(topic)); return push.to("refs/for/master%topic=" + name(topic));
} }
} }

View File

@@ -102,11 +102,11 @@ public abstract class AbstractSubmitByMerge extends AbstractSubmit {
PushOneCommit.Result change1 = PushOneCommit.Result change1 =
pushFactory pushFactory
.create(admin.newIdent(), testRepo, "Change 1", "a", "a") .create(admin.newIdent(), testRepo, "Change 1", "a", "a")
.to("refs/for/master/" + name("topic")); .to("refs/for/master%topic=" + name("topic"));
PushOneCommit push2 = pushFactory.create(admin.newIdent(), testRepo, "Change 2", "b", "b"); PushOneCommit push2 = pushFactory.create(admin.newIdent(), testRepo, "Change 2", "b", "b");
push2.noParents(); push2.noParents();
PushOneCommit.Result change2 = push2.to("refs/for/master/" + name("topic")); PushOneCommit.Result change2 = push2.to("refs/for/master%topic=" + name("topic"));
change2.assertOkStatus(); change2.assertOkStatus();
approve(change1.getChangeId()); approve(change1.getChangeId());

View File

@@ -217,7 +217,7 @@ public class SubmitResolvingMergeCommitIT extends AbstractDaemonTest {
"new.txt", "new.txt",
"Conflicting line #2", "Conflicting line #2",
ImmutableList.of(f.getCommit()), ImmutableList.of(f.getCommit()),
"refs/for/master/" + name("topic1")); "refs/for/master%topic=" + name("topic1"));
PushOneCommit.Result h = createChange(project2, "H"); PushOneCommit.Result h = createChange(project2, "H");
PushOneCommit.Result i = PushOneCommit.Result i =
@@ -231,7 +231,7 @@ public class SubmitResolvingMergeCommitIT extends AbstractDaemonTest {
"new.txt", "new.txt",
"Sadly conflicting topic-wise", "Sadly conflicting topic-wise",
ImmutableList.of(i.getCommit(), j.getCommit()), ImmutableList.of(i.getCommit(), j.getCommit()),
"refs/for/master/" + name("topic1")); "refs/for/master%topic=" + name("topic1"));
approve(h.getChangeId()); approve(h.getChangeId());
approve(i.getChangeId()); approve(i.getChangeId());
@@ -253,7 +253,7 @@ public class SubmitResolvingMergeCommitIT extends AbstractDaemonTest {
"new.txt", "new.txt",
"Resolving conflicts again", "Resolving conflicts again",
ImmutableList.of(c.getCommit(), g.getCommit()), ImmutableList.of(c.getCommit(), g.getCommit()),
"refs/for/master/" + name("topic1")); "refs/for/master%topic=" + name("topic1"));
approve(l.getChangeId()); approve(l.getChangeId());
assertChangeSetMergeable(l.getChange(), true); assertChangeSetMergeable(l.getChange(), true);

View File

@@ -117,12 +117,12 @@ public class SubmittedTogetherIT extends AbstractDaemonTest {
// Create two independent commits and push. // Create two independent commits and push.
RevCommit c1_1 = commitBuilder().add("a.txt", "1").message("subject: 1").create(); RevCommit c1_1 = commitBuilder().add("a.txt", "1").message("subject: 1").create();
String id1 = getChangeId(c1_1); String id1 = getChangeId(c1_1);
pushHead(testRepo, "refs/for/master/" + name("connectingTopic"), false); pushHead(testRepo, "refs/for/master%topic=" + name("connectingTopic"), false);
testRepo.reset(initialHead); testRepo.reset(initialHead);
RevCommit c2_1 = commitBuilder().add("b.txt", "2").message("subject: 2").create(); RevCommit c2_1 = commitBuilder().add("b.txt", "2").message("subject: 2").create();
String id2 = getChangeId(c2_1); String id2 = getChangeId(c2_1);
pushHead(testRepo, "refs/for/master/" + name("connectingTopic"), false); pushHead(testRepo, "refs/for/master%topic=" + name("connectingTopic"), false);
if (isSubmitWholeTopicEnabled()) { if (isSubmitWholeTopicEnabled()) {
assertSubmittedTogether(id1, id2, id1); assertSubmittedTogether(id1, id2, id1);
@@ -137,12 +137,12 @@ public class SubmittedTogetherIT extends AbstractDaemonTest {
public void anonymousWholeTopic() throws Exception { public void anonymousWholeTopic() throws Exception {
RevCommit initialHead = projectOperations.project(project).getHead("master"); RevCommit initialHead = projectOperations.project(project).getHead("master");
RevCommit a = commitBuilder().add("a", "1").message("change 1").create(); RevCommit a = commitBuilder().add("a", "1").message("change 1").create();
pushHead(testRepo, "refs/for/master/" + name("topic"), false); pushHead(testRepo, "refs/for/master%topic=" + name("topic"), false);
String id1 = getChangeId(a); String id1 = getChangeId(a);
testRepo.reset(initialHead); testRepo.reset(initialHead);
RevCommit b = commitBuilder().add("b", "1").message("change 2").create(); RevCommit b = commitBuilder().add("b", "1").message("change 2").create();
pushHead(testRepo, "refs/for/master/" + name("topic"), false); pushHead(testRepo, "refs/for/master%topic=" + name("topic"), false);
String id2 = getChangeId(b); String id2 = getChangeId(b);
requestScopeOperations.setApiUserAnonymous(); requestScopeOperations.setApiUserAnonymous();
@@ -161,16 +161,16 @@ public class SubmittedTogetherIT extends AbstractDaemonTest {
RevCommit c1_1 = commitBuilder().add("a.txt", "1").message("subject: 1").create(); RevCommit c1_1 = commitBuilder().add("a.txt", "1").message("subject: 1").create();
String id1 = getChangeId(c1_1); String id1 = getChangeId(c1_1);
pushHead(testRepo, "refs/for/master/" + name("connectingTopic"), false); pushHead(testRepo, "refs/for/master%topic=" + name("connectingTopic"), false);
testRepo.reset(initialHead); testRepo.reset(initialHead);
RevCommit c2_1 = commitBuilder().add("b.txt", "2").message("subject: 2").create(); RevCommit c2_1 = commitBuilder().add("b.txt", "2").message("subject: 2").create();
String id2 = getChangeId(c2_1); String id2 = getChangeId(c2_1);
pushHead(testRepo, "refs/for/master/" + name("connectingTopic"), false); pushHead(testRepo, "refs/for/master%topic=" + name("connectingTopic"), false);
RevCommit c3_1 = commitBuilder().add("b.txt", "3").message("subject: 3").create(); RevCommit c3_1 = commitBuilder().add("b.txt", "3").message("subject: 3").create();
String id3 = getChangeId(c3_1); String id3 = getChangeId(c3_1);
pushHead(testRepo, "refs/for/master/" + name("unrelated-topic"), false); pushHead(testRepo, "refs/for/master%topic=" + name("unrelated-topic"), false);
if (isSubmitWholeTopicEnabled()) { if (isSubmitWholeTopicEnabled()) {
assertSubmittedTogether(id1, id2, id1); assertSubmittedTogether(id1, id2, id1);
@@ -189,16 +189,16 @@ public class SubmittedTogetherIT extends AbstractDaemonTest {
RevCommit c1_1 = commitBuilder().add("a.txt", "1").message("subject: 1").create(); RevCommit c1_1 = commitBuilder().add("a.txt", "1").message("subject: 1").create();
String id1 = getChangeId(c1_1); String id1 = getChangeId(c1_1);
pushHead(testRepo, "refs/for/master/" + name("connectingTopic"), false); pushHead(testRepo, "refs/for/master%topic=" + name("connectingTopic"), false);
testRepo.reset(initialHead); testRepo.reset(initialHead);
RevCommit c2_1 = commitBuilder().add("b.txt", "2").message("subject: 2").create(); RevCommit c2_1 = commitBuilder().add("b.txt", "2").message("subject: 2").create();
String id2 = getChangeId(c2_1); String id2 = getChangeId(c2_1);
pushHead(testRepo, "refs/for/master/" + name("otherConnectingTopic"), false); pushHead(testRepo, "refs/for/master%topic=" + name("otherConnectingTopic"), false);
RevCommit c3_1 = commitBuilder().add("b.txt", "3").message("subject: 3").create(); RevCommit c3_1 = commitBuilder().add("b.txt", "3").message("subject: 3").create();
String id3 = getChangeId(c3_1); String id3 = getChangeId(c3_1);
pushHead(testRepo, "refs/for/master/" + name("connectingTopic"), false); pushHead(testRepo, "refs/for/master%topic=" + name("connectingTopic"), false);
RevCommit c4_1 = commitBuilder().add("b.txt", "4").message("subject: 4").create(); RevCommit c4_1 = commitBuilder().add("b.txt", "4").message("subject: 4").create();
String id4 = getChangeId(c4_1); String id4 = getChangeId(c4_1);
@@ -211,7 +211,7 @@ public class SubmittedTogetherIT extends AbstractDaemonTest {
RevCommit c6_1 = commitBuilder().add("c.txt", "6").message("subject: 6").create(); RevCommit c6_1 = commitBuilder().add("c.txt", "6").message("subject: 6").create();
String id6 = getChangeId(c6_1); String id6 = getChangeId(c6_1);
pushHead(testRepo, "refs/for/master/" + name("otherConnectingTopic"), false); pushHead(testRepo, "refs/for/master%topic=" + name("otherConnectingTopic"), false);
if (isSubmitWholeTopicEnabled()) { if (isSubmitWholeTopicEnabled()) {
assertSubmittedTogether(id1, id6, id5, id3, id2, id1); assertSubmittedTogether(id1, id6, id5, id3, id2, id1);