Replication with remoteNameStyle = basenameOnly fails

95 views
Skip to first unread message

kenwenzel

unread,
Apr 14, 2014, 5:40:30 AM4/14/14
to repo-d...@googlegroups.com
Hello,

I've tried to use replication with "basenameOnly" but it seems that this option does also remove the last dot-separated
segment from the basename itself.
Hence "komma/net.enilink.vocab.owl" becomes "net.enilink.vocab" instead of "net.enilink.vocab.owl".

I use the following configuration:

[remote "github.com"]
        url = ssh://g...@github.com/komma/${name}.git
        authGroup = KOMMA-MIRROR-github
        remoteNameStyle = basenameOnly

For a configuration without "basenameOnly" the replication is working correctly:

[remote "github.com"]
        url = ssh://g...@github.com/${name}.git
        authGroup = KOMMA-MIRROR-github

Is this a bug in the replication plugin or am I doing something wrong?

Btw, a fix for issue 886 would also solve my problem.

Thank you and best regards,
Ken

Steffen Gebert

unread,
Apr 14, 2014, 8:08:23 AM4/14/14
to Repo and Gerrit Discussion
Hi Ken,

okay, it makes totally sense, if your project name doesn't include the .git suffix. I did not expect that, while writing this code [1].

Can you propose a fix? Otherwise I hope to find time to dig into it the next days, although I admit that I don't have a Gerrit dev setup running atm.

Yours
Steffen

[1] https://gerrit-review.googlesource.com/48220
> --
> --
> To unsubscribe, email repo-discuss...@googlegroups.com
> More info at http://groups.google.com/group/repo-discuss?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

kenwenzel

unread,
Apr 14, 2014, 8:35:39 AM4/14/14
to repo-d...@googlegroups.com
Hi Steffen,

thank you for the quick response.


okay, it makes totally sense, if your project name doesn't include the .git suffix. I did not expect that, while writing this code [1].

Can you propose a fix? Otherwise I hope to find time to dig into it the next days, although I admit that I don't have a Gerrit dev setup running atm.

You could use java.nio.Paths and java.nio.Path:

Paths.get(name).getFileName()

http://docs.oracle.com/javase/tutorial/essential/io/pathOps.html

Furthermore, it would be cool to have something like:


[remote "github.com"]
     url = ssh://g...@github.com/${name}.git
rewrite   = ^komma/incubator/(.*) komma/$1
     rewrite.1 = silly__named_project cool-project-name
rewrite.3 = / -
     exclude   = ^komma/(attic|playground)
include = ^(komma|public) # this would be an alternative for current 'projects' option
 
The rewrites are simple executed in order, e.g. by using:

Matcher m = Pattern.compile(matchPattern);
if (m.find()) {
m.replaceAll(replacement);
}

This would also make the dash and underscore stuff superfluous.

Best regards,
Ken
 

Shahim Essaid

unread,
Apr 18, 2014, 5:39:32 PM4/18/14
to repo-d...@googlegroups.com


okay, it makes totally sense, if your project name doesn't include the .git suffix. I did not expect that, while writing this code [1].


I think Gerrit removes the .git suffix form the name anyway. I tried creating a project with .git suffix in the UI and it was removed and I couldn't replicate because the getBaseName() was removing the next suffix from my project name. I changed that to getName(), compiled, and installed and it is now working.

 My original project name was "gerrithub.test.1.git" but Gerrit changed it to "gerrithub.test.1" and the getBaseName() makes it "gerrithub.test". Only getting the name (as opposed to base name) fixes this. This was with Gerrit version 2.8.4

Best,
Shahim

 
Reply all
Reply to author
Forward
0 new messages