Conversation
tools/Messages
Outdated
There was a problem hiding this comment.
Update the main README as well
bce4b60 to
8f71c1b
Compare
|
I found a Pythonista in the company to do additional (sic!) review for the python scripts, still need someone to look at the Messages changes. Also, I will probably switch our production instance to these scripts to give it additional testing. |
| * @return string representation of the field value | ||
| * @throws java.io.IOException | ||
| */ | ||
| protected String invokeGetter(Configuration config, String field) throws IOException { |
There was a problem hiding this comment.
this may be a candidate for a util function along with invokeSetter
There was a problem hiding this comment.
you mean moving this to org.opensolaris.opengrok.util as a utility class ? or possibly to Configuration.java ?
There was a problem hiding this comment.
t thought more about a new utility class but you decide both is better than have it here
There was a problem hiding this comment.
or maybe if you extract this to the ClassUtils and make it more generic (for any object and not just for configuration) and then you can delegate these calls from here. How about that?
|
|
||
| /* | ||
| /* | ||
| * Copyright (c) 2017, 2017, Oracle and/or its affiliates. All rights reserved. |
There was a problem hiding this comment.
fixed, hopefully we won't have to deal with this anymore soon.
| + toInteger(hasTag("auth")) | ||
| + toInteger(hasTag("get")) | ||
| + toInteger(hasTag("set")) > 1) { | ||
| throw new Exception("The message tag must be either setconf, getconf, auth or set"); |
There was a problem hiding this comment.
fixed by rewriting this test
|
|
||
| /* | ||
| /* | ||
| * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
|
|
||
| switch (msgtext) { | ||
| case "get-repo-type": | ||
| List<String> types = new ArrayList<>(); |
There was a problem hiding this comment.
maybe a linked list? or array list with known capacity? to reduce the unnecessary overhead
There was a problem hiding this comment.
used specified initial capacity
| types.add("N/A"); | ||
| } | ||
| } | ||
| ret = types.stream().collect(Collectors.joining("\n")).toString(); |
There was a problem hiding this comment.
just some thoughts..
this gives for a message with tags
-t opengrok -t opengrok-master -t nothing
the result
git
git
N/A
isn't something like
opengrok: git
opengrok-master: git
nothing: N/A
better?
or some json?
There was a problem hiding this comment.
okay, will use the colon separated output.
I will save JSON output for #1801.
| @Override | ||
| public void validate() throws Exception { | ||
| String command = getText(); | ||
| Set<String> allowedText = new TreeSet<>(Arrays.asList("get-repo-type")); |
| /* | ||
| /* | ||
| * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. | ||
| * Portions Copyright (c) 2017, Chris Fraire <cfraire@me.com>. |
| public void setUp() throws IOException { | ||
| Assume.assumeTrue(new MercurialRepository().isWorking()); | ||
| Assume.assumeTrue(new SubversionRepository().isWorking()); | ||
| Assume.assumeTrue(new GitRepository().isWorking()); |
There was a problem hiding this comment.
I think I included the repeateable conditional rule for this, can you try it?
There was a problem hiding this comment.
these are not needed, removed.
| Assume.assumeTrue(new MercurialRepository().isWorking()); | ||
| Assume.assumeTrue(new SubversionRepository().isWorking()); | ||
| Assume.assumeTrue(new GitRepository().isWorking()); | ||
|
|
There was a problem hiding this comment.
do you need git and subversion in this test?
There was a problem hiding this comment.
technically only the mercurial is needed. I have extended the test to check git repo as well and used the repeated annotation.
|
For the record, here are the python comments: (11:25:01) timf: vladimir.kotal: platform/solaris/ips/create.sh looks pretty antiquated. You really should replace that with a single p5m manifest and pkgsend publish
(11:58:28) timf: line 28, os.mkdir should perhaps be os.makedirs, so as to make any intermediate dirs along the way |
|
looking forward to try it out once merged, thank you Vlad :) |
|
@tarzanek I am a bit worried about the Python scripts having hardcoded Python 3.4 so might not run on anything else (3.5) even if it could. |
6fe3889 to
1146e34
Compare
1146e34 to
f70fbdf
Compare
|
d'oh ... so once again the history repeats and the same language is not compatible with its own old versions? |
|
Well, python 2 and python 3 are different languages. This is not C. That
said, I can probably make the script headers use Python 3 or even generic
Python (since the script have embedded version checks) and hope it will run
on all 3.x.
Dne 16. 1. 2018 6:04 odp. napsal uživatel "Lubos Kosco" <
notifications@github.com>:
… d'oh ... so once again the history repeats and the same language is not
compatible with its own old versions?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#1975 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACzGDDGGPYwRXiNzNQ_aJYKWfwDEFX_yks5tLNZ7gaJpZM4Ra_Lv>
.
|
|
how about /usr/bin/env python3 ? this should lead to the recent version of python3 on the system, or? |
|
I was thinking about |
|
you can add a check in the code that the version is atleast 3 and throw an exception? |
|
The version check is already present however this is still not going to work on a system which has both Python 2 and 3 but |
|
Ok I didn't see it |
1bc5256 to
1df674a
Compare
|
I will just bite the bullet and use |
|
I agree, since it seems most OSes have python3 symlink, no ? thnx |
|
|
yes I am for python3 |
|
windows also doesn't have it, but I am OK with Ubuntu(Debian) and macOS :) |
This set of changes adds a bunch of Python scripts to synchronize SCM repositories (git, Mercurial, CVS, SVN, Teamware are supported) with their parents/upstream. Plus pre-requisite changes to Messages.
The main
mirror.pyscript is supposed to be run per-project via the already existingsync.pyscript.