-
Notifications
You must be signed in to change notification settings - Fork 744
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
Mirroring scripts #1975
Mirroring scripts #1975
Conversation
echo " repository:" | ||
echo " - repository paths relative to source root are specified as <tags>" | ||
echo " - command is specified in message <text>:" | ||
echo " - \"get-repo-type\" - returns type of the repository or \"N/A\"" |
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.
Update the main README as well
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.
fixed
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may be a candidate for a util function along with invokeSetter
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 mean moving this to org.opensolaris.opengrok.util
as a utility class ? or possibly to Configuration.java
?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
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.
yep, that's what I did.
@@ -17,7 +17,7 @@ | |||
* CDDL HEADER END | |||
*/ | |||
|
|||
/* | |||
/* | |||
* Copyright (c) 2017, 2017, Oracle and/or its affiliates. All rights reserved. |
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.
copyright
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.
fixed, hopefully we won't have to deal with this anymore soon.
@@ -252,6 +301,7 @@ public void validate() throws Exception { | |||
if (toInteger(hasTag("setconf")) | |||
+ toInteger(hasTag("getconf")) | |||
+ 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+ get
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.
fixed by rewriting this test
@@ -17,7 +17,7 @@ | |||
* CDDL HEADER END | |||
*/ | |||
|
|||
/* | |||
/* | |||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
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.
copy
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.
fixed
|
||
switch (msgtext) { | ||
case "get-repo-type": | ||
List<String> types = new ArrayList<>(); |
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.
maybe a linked list? or array list with known capacity? to reduce the unnecessary overhead
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.
used specified initial capacity
types.add("N/A"); | ||
} | ||
} | ||
ret = types.stream().collect(Collectors.joining("\n")).toString(); |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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")); |
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.
allowedTexts
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.
fixed
@@ -17,7 +17,7 @@ | |||
* CDDL HEADER END | |||
*/ | |||
|
|||
/* | |||
/* | |||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. | |||
* Portions Copyright (c) 2017, Chris Fraire <cfraire@me.com>. |
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.
18
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.
fixed
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I included the repeateable conditional rule for this, can you try it?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need git and subversion in this test?
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.
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.py
script is supposed to be run per-project via the already existingsync.py
script.