views:

792

answers:

4

I am using SVN+SSH to check out a working copy of repository from an SVN server on which all developers are members of a developer group and have full read/write permissions on the repository directory and associated metadata:

svn co svn+ssh://[email protected]/path/to/repository

Several developers work on the same working copy that is checked out under a shared shell account (root). Because this repository is being used for configuration revision control in a production environment, this is unavoidable. Giving each developer an individual shell account on the target machine (the one on which the checkout is being done) would be one way to solve this problem because then they could each have their own working copy, but unfortunately this is not acceptable here.

We have various post-commit hooks that send e-mails detailing commits, including the username of the person that committed the change.

The problem is that once a working copy is checked out with a given username using the svn+ssh:// URI scheme, commits and updates seem to also have to be done under that username. This is not viable for two reasons:

1) The person who originally made the checkout may not be the person making a commit now, and we need the post-commit e-mails and other post-commit hooks to know exactly who made the commit, and

2) clearly, a commit requires that the committing user know the password of the account of the person who made the original checkout, the use of RSA keys for non-interactive authentication notwithstanding for reason #1.

Is there a way to do dynamically switch out the username of the remote account that is being used for authentication in this scenario?

I did some research and found this question previously:

http://stackoverflow.com/questions/581485/changing-the-username-for-a-subversion-commit-over-svnssh

Unfortunately, the suggestion in the accepted answer (svn switch) does not work:

[root@db repo-directory]# svn switch svn+ssh://[email protected]/u/svc/repositories/repo-name
[email protected]'s password: 
svn: 'svn+ssh://[email protected]/u/svc/repositories/repo-name' is not the same
repository as 'svn+ssh://[email protected]/u/svc/repositories/repo-name'

Any ideas would be greatly appreciated. Thank you in advance for your consideration!

+1  A: 

Ah, well, never mind. It seems that svn switch --relocate does the trick:

svn switch --relocate svn+ssh://[email protected]/path/to/repo svn+ssh://[email protected]/path/to/repo

It's cumbersome, though. If there's any easier way, I'm open to suggestions.

Obviously, one can write a bash alias or shell-script to automate this part, I suppose, but I wish it were simpler than that.

Alex Balashov
+1  A: 

Check out this similar question I asked over on serverfault.

emptyset
+1  A: 

You could do a simple update with another username, too.

svn update --username <user> --password <pwd>
tangens
If I'm not mistaken, that only works with svnserve, not svn+ssh.
Alex Balashov
I must admit, I havn't tried it with protocol `svn+ssh`. But it works with protocol `http` and not only with svnserve.
tangens
A: 

It works with ssh+svn if you modify your client's config: $HOME/.subversion/config tunnels section:

ssh = $SVN_SSH ssh -l *youruser*
qrtalaci