-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
+ [JENKINS-30176] Repository browser VisualSVN added #163
Conversation
Ad build failure) Well, external repository https://svn.jenkins-ci.org/ is not available. No test error is related to my change (there's no test on browser provider implementation). |
Fixed just by merging to the latest sources (after version 2.6). |
I am wondering why is it still opened (waiting)? And not accepted or rejected. I am forced to use my own plugin's build. I would like to handle SVN plugin as any other in Plugin Manager. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Javadoc does not seem to be finalized according to DOCUMENT ME!
comments. There are also some minor glitches in the code
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Daniel Dyer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likely the license header is wrong
// https://issues.jenkins-ci.org/browse/JENKINS-30176 | ||
public class VisualSVN extends SubversionRepositoryBrowser { | ||
|
||
private static final Logger LOGGER = Logger.getLogger(VisualSVN.class.getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting
@Extension | ||
public static class DescriptorImpl extends Descriptor<RepositoryBrowser<?>> { | ||
public String getDisplayName() { | ||
return "VisualSVN"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good practice: Keep the name localizable. https://wiki.jenkins-ci.org/display/JENKINS/Internationalization
* It may contain a query parameter like <tt>?root=foobar</tt>, so relative | ||
* URL construction needs to be done with care.</p> | ||
*/ | ||
public final String url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use private field and getter. Otherwise you will be never able to change the data structure without breaking compatibility
this.url = validateUrl(url); | ||
} | ||
|
||
private String validateUrl(URL url) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confusing method name. Nothing is validated here
<f:entry title="URL" field="url"> | ||
<f:textbox /> | ||
</f:entry> | ||
</j:jelly> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good practice: add line breaks to the last file lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, there's a lot of comments :-). I just copied some other plugin (comments, maybe XML additional line, etc.) and modified it for VisualSVN.
I wil try to fix it according comments above. It should be simple.
// https://demo-server.visualsvn.com/!/#tortoisesvn/commit/r27333/head/trunk/src/Utils/MiscUI/SciEdit.cpp | ||
int r = path.getLogEntry().getRevision(); | ||
String value = String.format("%s/commit/r%d/head%s", url, r, path.getValue()); | ||
LOGGER.fine("DiffLink URL: " + value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use formatter to avoid non-required string concatenations
@Override public URL getFileLink(Path path) throws IOException { | ||
// https://demo-server.visualsvn.com/!/#tortoisesvn/view/head/svnrobots.txt | ||
String value = String.format("%s/view/head%s", url, path.getValue()); | ||
LOGGER.fine("FileLink URL: " + value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
throws IOException { | ||
// https://demo-server.visualsvn.com/!/#tortoisesvn/commit/r27333 | ||
String value = String.format("%s/commit/r%d", url, changeSet.getRevision()); | ||
LOGGER.fine("ChangeSetLink URL: " + value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
* {@link RepositoryBrowser} for Subversion. | ||
* | ||
* @author Arnost Havelka | ||
* @since 2.5.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace the since
value by TODO. It may not be merged into the specified version
I tried to fix all commets, but I am not sure about source formatting (where is it defined) and formatter (I used String.format()). Is it sufficient? If not, can you provide more details/hints? |
So there are two approaches, which are good from the performance PoV. See the examples below. Approach 1 if (LOGGER.isLoggable(Level.FINE)) {
String value = String.format("%s/commit/r%d/head%s", url, r, path.getValue());
LOGGER.fine("DiffLink URL: " + value);
} Approach 2 LOGGER.log(Level.FINE, "DiffLink URL: {0}/commit/r{1}/head{2}", new Object[] {url, r, path.getValue()}); |
LOGGER is fixed --> I was focused on fomatting of the value itself, not the logging the value. |
@oleg-nenashev any updates on when the merge will happen? |
Just making some noise: any news on an integration date? |
@yultide @Bebef The plugin has no maintainer. @recena is inactive, and there is a plan to mark the plugin for adoption. See https://wiki.jenkins-ci.org/display/JENKINS/Adopt+a+Plugin for more info. The only thing I can do here is to review the PR after the last changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code will probably work, but the formatting is still messed up.
*/ | ||
public class VisualSVN extends SubversionRepositoryBrowser { | ||
|
||
private static final Logger LOGGER = Logger.getLogger(VisualSVN.class.getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabs vs. spaces
throw new MalformedURLException(Messages.SubversionSCM_doCheckRemote_invalidUrl()); | ||
} | ||
String value = url.toString(); | ||
if (value == null || value.equals("")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringUtils.isBlank()
. Otherwise you will be accepting blank strings like " "
* @throws MalformedURLException when URL is not valid (empty) | ||
*/ | ||
@DataBoundConstructor | ||
public VisualSVN(URL url) throws MalformedURLException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if Stapler handles URLs reliably. CC @daniel-beck and @vivek
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should make the parameter type be String
, to match that of the getter. Otherwise this will not be compatible with Pipeline’s Snippet Generator, for example, and might cause mayhem in JEP-201 etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's better to fix it before merge
// https://demo-server.visualsvn.com/!/#tortoisesvn/view/head/svnrobots.txt | ||
String value = String.format("%s/view/head%s", url, path.getValue()); | ||
if (LOGGER.isLoggable(Level.FINE)) { | ||
LOGGER.fine("FileLink URL: " + value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if it is helpful even at the FINE level. Maybe DEBUG?
// https://demo-server.visualsvn.com/!/#tortoisesvn/commit/r27333 | ||
String value = String.format("%s/commit/r%d", url, changeSet.getRevision()); | ||
if (LOGGER.isLoggable(Level.FINE)) { | ||
LOGGER.fine("ChangeSetLink URL: " + value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
@@ -1,86 +1,88 @@ | |||
# The MIT License | |||
# | |||
# Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe, Yahoo! Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting changes messed up the diff here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably good enough.
@@ -1,86 +1,88 @@ | |||
# The MIT License | |||
# | |||
# Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe, Yahoo! Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
<f:entry title="URL" field="url"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forget a getUrl
method, so config round-trip does not work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, it's not clear to me. Where should I use getUrl
method? I was not able to find any usage of it in other config.jelly
files.
Please, can you be more specific or fix it? I just did "copy & past " on one browser (don't know which one now). The solution was working correctly as I know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arnosthavelka I am not an expert but I think it might be something like here:
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="URL" help="/plugin/WebSVN2/help-url.html">
<f:textbox field="reposUrl" name="webSVN2.url" value="${browser.url}"/>
</f:entry>
</j:jelly>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure whether the suggestion by queil is right answer My config.jelly
has same content as for SVNWeb, ViewSVN, WebSVN. The other implementation have same <f:entry/>
for "URL" content, but additional element <f:entry/>
for "Repository".
Should I use this?
<f:entry title="URL" help="/plugin/VisualSVN/help-url.html">
@jglick Please, can you confirm it or clarify your claim?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advice from @queil is incorrect. The f:entry
and empty f:textbox
are fine; you just need to add a getUrl
getter method to the bean. See Jenkins docs on form databinding. (You could reproduce your bug using one of the JenkinsRule.configRoundtrip
overloads if you cared to.)
No help
attribute is necessary: you are following the conventional location of help-url.html
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
@oleg-nenashev Please, can you remove "merge-conflict" tag? It's already up-to-date. |
removed the label, the PR still needs review feedback |
@jenkinsci/code-reviewers |
|
||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
<f:entry title="URL" field="url"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advice from @queil is incorrect. The f:entry
and empty f:textbox
are fine; you just need to add a getUrl
getter method to the bean. See Jenkins docs on form databinding. (You could reproduce your bug using one of the JenkinsRule.configRoundtrip
overloads if you cared to.)
No help
attribute is necessary: you are following the conventional location of help-url.html
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still a mistake in databinding I think.
* @throws MalformedURLException when URL is not valid (empty) | ||
*/ | ||
@DataBoundConstructor | ||
public VisualSVN(URL url) throws MalformedURLException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should make the parameter type be String
, to match that of the getter. Otherwise this will not be compatible with Pipeline’s Snippet Generator, for example, and might cause mayhem in JEP-201 etc.
@@ -90,4 +90,4 @@ CredentialsSVNAuthenticationProviderImpl.credentials_in_realm=Found credentials | |||
CredentialsSVNAuthenticationProviderImpl.sole_credentials=Using sole credentials {0} in realm \u2018{1}\u2019 | |||
CredentialsSVNAuthenticationProviderImpl.missing_credentials=No credentials found for realm \u2018{0}\u2019 among \u2018{1}\u2019; falling back to {2} | |||
|
|||
|
|||
SubversionSCM.browsers.VisualSVN=VisualSVN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best to add a trailing newline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just merged with latest changes and added trailing newline to the messages.properties file (as requested).
However I'm not sure about the request to change the param from URL to String. Almost every implementation (except Assembla) has it in the same way (as URL). Therefore I propose to do not change the parameter type, since I'm not able to verify the correctness of the change anymore. If it will be problem for Snippet Generator then someone will have to change it in all others implementations anyway.
Please, can we finish it now? We are discussing PR for 2 years now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately it's what we have for barely maintained plugins.
I and @jglick spent some time on cleaning up the PR queue this summer, but there were other maintainers before.
@kuisathaverat was interested in taking ownership of the plugin tho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arnosthavelka I made a PR with the suggested pending changes, merge it on your branch and I think that this PR is ready to merge
@jglick Please, can you check my comment? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 change is required in the constructor the rest looks good to me, would be great to finally merge it
* @throws MalformedURLException when URL is not valid (empty) | ||
*/ | ||
@DataBoundConstructor | ||
public VisualSVN(URL url) throws MalformedURLException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's better to fix it before merge
|
||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
<f:entry title="URL" field="url"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
@@ -90,4 +90,4 @@ CredentialsSVNAuthenticationProviderImpl.credentials_in_realm=Found credentials | |||
CredentialsSVNAuthenticationProviderImpl.sole_credentials=Using sole credentials {0} in realm \u2018{1}\u2019 | |||
CredentialsSVNAuthenticationProviderImpl.missing_credentials=No credentials found for realm \u2018{0}\u2019 among \u2018{1}\u2019; falling back to {2} | |||
|
|||
|
|||
SubversionSCM.browsers.VisualSVN=VisualSVN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately it's what we have for barely maintained plugins.
I and @jglick spent some time on cleaning up the PR queue this summer, but there were other maintainers before.
@kuisathaverat was interested in taking ownership of the plugin tho
[visualsvn] changes sugested by @jglick and @oleg-nenashev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's ship it
What's the status? To avoid merging additional changes :-). |
@arnosthavelka it is my fault, I think I have merged it |
[JENKINS-30176] Repository browser VisualSVN added