Skip to content

Project message set/get - #2153

Merged
vladak merged 6 commits into
oracle:masterfrom
vladak:projectmessage_set_get
Jun 14, 2018
Merged

vladak merged 6 commits into
oracle:masterfrom
vladak:projectmessage_set_get

Conversation

@vladak

@vladak vladak commented Jun 11, 2018

Copy link
Copy Markdown
Member

Introduces set/get commands for Project message. Both the command name and its arguments have to reside in message text since the tags are already used for project names.

@coveralls

coveralls commented Jun 11, 2018 •

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 2554

  • 36 of 45 (80.0%) changed or added relevant lines in 1 file are covered.
  • 52 unchanged lines in 8 files lost coverage.
  • Overall coverage decreased (-0.004%) to 72.859%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/org/opensolaris/opengrok/configuration/messages/ProjectMessage.java 36 45 80.0%
Files with Coverage Reduction New Missed Lines %
src/org/opensolaris/opengrok/configuration/messages/ProjectMessage.java 1 87.5%
src/org/opensolaris/opengrok/history/SCCSRepository.java 1 79.27%
src/org/opensolaris/opengrok/configuration/IndexTimestamp.java 2 52.38%
src/org/opensolaris/opengrok/history/HistoryGuru.java 2 75.4%
src/org/opensolaris/opengrok/history/RepositoryFactory.java 3 86.27%
src/org/opensolaris/opengrok/history/BitKeeperRepository.java 3 79.72%
src/org/opensolaris/opengrok/configuration/RuntimeEnvironment.java 5 71.43%
src/org/opensolaris/opengrok/history/MercurialRepository.java 35 81.97%
Totals Coverage Status
Change from base Build 2548: -0.004%
Covered Lines: 31193
Relevant Lines: 42813

πŸ’› - Coveralls

throw new Exception("The message must contain a tag (project name(s))");
}

if (command.compareTo("get") == 0 && getTags().size() != 1) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

command.equals("get")?

break;
case "get":
for (String projectName : getTags()) {
Project project;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems more readable to me:

Project project = env.getProjects().get(projectName);
if (project != null) {
...

}

for (String projectName : getTags()) {
Project project;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as below.


switch (command) {
switch (getCommand()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why call getCommand() for the second time? The result is already in command variable.

}
}

return String.format("Variable \"%s\" set to \"%s\".",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried that this will set just the first project in getTags().

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And a test case for this would be great

for (String projectName : getTags()) {
Project project;
if ((project = env.getProjects().get(projectName)) != null) {
return ClassUtil.invokeGetter(project, getText().substring(4)).getBytes();

@tulinkry tulinkry Jun 11, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried that this will use just the first project in getTags().

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a check that get can only have one project specified.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see that, ok.

@@ -495,4 +497,53 @@ public void testGetRepos() throws Exception {
out = new String(m.apply(env));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the setUp():

Assume.assumeTrue(new MercurialRepository().isWorking());
Assume.assumeTrue(new SubversionRepository().isWorking());
Assume.assumeTrue(new GitRepository().isWorking());

can you please replace it with the conditional run?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep


// Change their property.
m = new ProjectMessage();
m.setText("set handleRenamedFiles = false");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you try doing this test for = true? I'm still not conviced that this works for both of the projects and false seems to be the default value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the applyMessage() -> set -> return

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not committed the fix yet to see that the test is really failing. Coming in a minute..

}

@Test
@ConditionalRun(RepositoryInstalled.GitInstalled.class)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nb but this is now a duplicate

Comment thread tools/Messages
echo " in the webapp."
echo " Examples:"
echo " tabSize = 8"
echo " handleRenamedFiles = true"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and also I think there is a wiki page listing the tunables so it should be also added there

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vladak
vladak merged commit a0b5c30 into oracle:master Jun 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants