Merge branch 'stable-2.11'
* stable-2.11: Inline edit: Strip trailing blank lines from commit messages Tweak JS clipboard API integration to work on Firefox Include server config module in init step JarScanner: Fix minor typo in log message Silence meaningless warnings from JarScanner Change-Id: Ie928190f4c8f31a1bbfcc640b5c7a9f4109de5ff
This commit is contained in:
@@ -59,6 +59,8 @@ screen editor for that file.
|
||||
To save edits, click the 'Save' button or press `CTRL-S`. To return to the
|
||||
change screen, click the 'Close' button.
|
||||
|
||||
Note that when editing the commit message, trailing blank lines will be stripped.
|
||||
|
||||
image::images/inline-edit-full-screen-editor.png[width=800, link="images/inline-edit-full-screen-editor.png"]
|
||||
|
||||
If there are unsaved edits when the 'Close' button is pressed, a dialog will
|
||||
|
@@ -318,7 +318,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
assertThat(edit.get().getEditCommit().getParentCount()).isEqualTo(0);
|
||||
|
||||
String msg = String.format("New commit message\n\nChange-Id: %s",
|
||||
String msg = String.format("New commit message\n\nChange-Id: %s\n",
|
||||
change.getKey());
|
||||
assertThat(modifier.modifyMessage(edit.get(), msg))
|
||||
.isEqualTo(RefUpdate.Result.FORCED);
|
||||
@@ -345,8 +345,9 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
assertThat(modifier.createEdit(change, getCurrentPatchSet(changeId)))
|
||||
.isEqualTo(RefUpdate.Result.NEW);
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
|
||||
String msg = String.format("New commit message\n\nChange-Id: %s",
|
||||
assertUnchangedMessage(edit, edit.get().getEditCommit().getFullMessage());
|
||||
assertUnchangedMessage(edit, edit.get().getEditCommit().getFullMessage() + "\n\n");
|
||||
String msg = String.format("New commit message\n\nChange-Id: %s\n",
|
||||
change.getKey());
|
||||
assertThat(modifier.modifyMessage(edit.get(), msg)).isEqualTo(
|
||||
RefUpdate.Result.FORCED);
|
||||
@@ -373,7 +374,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
.isEqualTo(SC_NOT_FOUND);
|
||||
EditMessage.Input in = new EditMessage.Input();
|
||||
in.message = String.format("New commit message\n\n" +
|
||||
CONTENT_NEW2_STR + "\n\nChange-Id: %s",
|
||||
CONTENT_NEW2_STR + "\n\nChange-Id: %s\n",
|
||||
change.getKey());
|
||||
assertThat(adminSession.put(urlEditMessage(), in).getStatusCode())
|
||||
.isEqualTo(SC_NO_CONTENT);
|
||||
@@ -383,7 +384,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
assertThat(edit.get().getEditCommit().getFullMessage())
|
||||
.isEqualTo(in.message);
|
||||
in.message = String.format("New commit message2\n\nChange-Id: %s",
|
||||
in.message = String.format("New commit message2\n\nChange-Id: %s\n",
|
||||
change.getKey());
|
||||
assertThat(adminSession.put(urlEditMessage(), in).getStatusCode())
|
||||
.isEqualTo(SC_NO_CONTENT);
|
||||
@@ -712,6 +713,14 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
assertThat(approvals.get(0).value).isEqualTo(1);
|
||||
}
|
||||
|
||||
private void assertUnchangedMessage(Optional<ChangeEdit> edit, String message)
|
||||
throws Exception {
|
||||
exception.expect(UnchangedCommitMessageException.class);
|
||||
exception.expectMessage(
|
||||
"New commit message cannot be same as existing commit message");
|
||||
modifier.modifyMessage(edit.get(), message);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHasEditPredicate() throws Exception {
|
||||
assertThat(modifier.createEdit(change, ps)).isEqualTo(RefUpdate.Result.NEW);
|
||||
|
@@ -274,6 +274,7 @@ public class CopyableLabel extends Composite implements HasText {
|
||||
try {
|
||||
t.setText(getText());
|
||||
content.add(t);
|
||||
t.setFocus(true);
|
||||
t.selectAll();
|
||||
|
||||
boolean ok = execCommand("copy");
|
||||
|
@@ -518,6 +518,13 @@ public class EditScreen extends Screen {
|
||||
if (!cm.isClean(generation)) {
|
||||
close.setEnabled(false);
|
||||
String text = cm.getValue();
|
||||
if (Patch.COMMIT_MSG.equals(path)) {
|
||||
String trimmed = text.trim() + "\r";
|
||||
if (!trimmed.equals(text)) {
|
||||
text = trimmed;
|
||||
cm.setValue(text);
|
||||
}
|
||||
}
|
||||
final int g = cm.changeGeneration(false);
|
||||
ChangeEditApi.put(revision.getParentKey().get(), path, text,
|
||||
new GerritCallback<VoidResult>() {
|
||||
|
@@ -28,6 +28,7 @@ import com.google.gerrit.pgm.init.api.InitFlags;
|
||||
import com.google.gerrit.pgm.init.api.InstallPlugins;
|
||||
import com.google.gerrit.pgm.util.SiteProgram;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.config.GerritServerConfigModule;
|
||||
import com.google.gerrit.server.config.SitePath;
|
||||
import com.google.gerrit.server.config.SitePaths;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
@@ -222,6 +223,7 @@ public class BaseInit extends SiteProgram {
|
||||
throw die(err);
|
||||
}
|
||||
|
||||
m.add(new GerritServerConfigModule());
|
||||
m.add(new InitModule(standalone, initDb));
|
||||
m.add(new AbstractModule() {
|
||||
@Override
|
||||
|
@@ -227,6 +227,7 @@ public class ChangeEditModifier {
|
||||
public RefUpdate.Result modifyMessage(ChangeEdit edit, String msg)
|
||||
throws AuthException, InvalidChangeOperationException, IOException,
|
||||
UnchangedCommitMessageException {
|
||||
msg = msg.trim() + "\n";
|
||||
checkState(!Strings.isNullOrEmpty(msg), "message cannot be null");
|
||||
if (!currentUser.get().isIdentifiedUser()) {
|
||||
throw new AuthException("Authentication required");
|
||||
|
@@ -102,19 +102,19 @@ public class JarScanner implements PluginContentScanner {
|
||||
throw new InvalidPluginException("Cannot auto-register", err);
|
||||
} catch (RuntimeException err) {
|
||||
PluginLoader.log.warn(String.format(
|
||||
"Plugin %s has invaild class file %s inside of %s", pluginName,
|
||||
"Plugin %s has invalid class file %s inside of %s", pluginName,
|
||||
entry.getName(), jarFile.getName()), err);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (def.isConcrete()) {
|
||||
if (!Strings.isNullOrEmpty(def.annotationName)) {
|
||||
rawMap.put(def.annotationName, def);
|
||||
if (!Strings.isNullOrEmpty(def.annotationName)) {
|
||||
if (def.isConcrete()) {
|
||||
rawMap.put(def.annotationName, def);
|
||||
} else {
|
||||
PluginLoader.log.warn(String.format(
|
||||
"Plugin %s tries to @%s(\"%s\") abstract class %s", pluginName,
|
||||
def.annotationName, def.annotationValue, def.className));
|
||||
}
|
||||
} else {
|
||||
PluginLoader.log.warn(String.format(
|
||||
"Plugin %s tries to @%s(\"%s\") abstract class %s", pluginName,
|
||||
def.annotationName, def.annotationValue, def.className));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user