I am creating a plug-in for Eclipse that interacts with the Subclipse plug-in. One thing I would like to do is access the username (commit author name) that the person uses for accessing their Subversion repository(ies). For a simple case, I am assuming the person only has 1 repository checked out into their workspace and that I am only interested in the username that they use for that workspace, how can I access it?
Note: The simple case illustrates the problem I am trying to address, but I still need it to generalize to a scenario where there are potentially multiple repositories open.
I know that this information is stored somewhere because when I try to make a commit and Subclipse asks me to confirm my credentials, it has the username pre-filled out and I just have to enter my password.
How can I go about doing this?
Here is something I have tried, but doesn’t work:
String uname = "";
try {
uname = SVNProviderPlugin.getPlugin().getRepository("https://<path-to-my-repository>").getUsername();
} catch (SVNException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("Username: " + uname);
However, this outputs: Username: which tells me that the string uname is getting "".
Subclipse does not know what the user’s username is so there is no way to get this from Subclipse. About the only way you could do it would be to try to read Subversion’s cache files, but even that will not work if they are using SVNKit as it has its own cache.