views:

1519

answers:

12

Our I.T. dept doesn't allow connections to the SVN server from outside the physical office. (They're just kind of like that.) I need to work on projects when I'm not at the office.

I could just check out the project and wait until I come in to do a check-in. Maybe that would be best. But I like to check in frequently. I'm wondering if there's some way I can keep a project in two repositories and keep them both up to date. That way I'd always be able to check in somewhere in case my HD dies. I have my own repository on a VPS server that I use for personal projects.

I investigated the svn switch command. With my current project in both repos I tried switching my working copy from personal to work SVN servers...

$ svn switch --relocate svn+ssh://personalvps.com/svn/project/trunk svn://worksvn/project/trunk
svn: The repository at 'svn://worksvn/project/trunk' has uuid '2baef97e-42ce-488c-bbba-c2625158c643', but the WC has 'f13e1f32-dc92-4c4a-b84d-34a59fe32063'

Then I tried adding the --username and --password params but got an error saying "no entry found."

Is this even possible or is it totally impractical?


UPDATE

Thanks for the answers. Unfortunately, any solution that involves action from I.T. (slight policy change, change a setting somewhere, install something) is not on the table. I have to find a solution within the current setup, which is no connections from outside except our Web servers.

I'll take a look at distributed version control.

+8  A: 

Have you read about git? it uses a local repository for offline work, and can be easily synchronized with a svn repo.

Two articles that explain how to do what you want.

krusty.ar
When somebody asks "how do I do foo with SVN" why are the first responses "use git?" SVK works perfectly well and is more familiar to a SVN user.
Andy
It's the new "hot thing", even through it's not new :P
Alex Fort
Hey, I didn't even know about SVK, also what's wrong with recommending an arguably best solution? if he likes to have a local repo and commit often, then probably he will like git, as it promotes that workflow.
krusty.ar
Maybe he can't change the VCS they're using, so he needs to know how to do it with SVN.
toast
He doesn't need to change anything, just install git in his own computer, that's the point of the question.
krusty.ar
I used svk for a while, but it had some issues - git solved them and works so much better. I use git locally and then push formal patches back to the svn server.
DGM
+3  A: 

It is not practical for Subversion alone, but it is practical in distributed versioning systems such as git.

Have a look at git, and more importantly git-svn.

dreamlax
+11  A: 

You could use SVN with another (local) repository on your laptop. Look for the popular git or SVK. These allow you to commit to the local repository first and then sync all commits to the main SVN repository.

0xA3
+5  A: 

Look into svnsync. I use it to mirror an SVN repository on source forge to a personal box so I can use Trac with it. http://svn.collab.net/repos/svn/trunk/notes/svnsync.txt

It's very easy to use, and you should be able to set your office repo up to sync to a personal repository.

Alex Fort
Thanks, looks awesome -- I'll keep it in mind for the future. But it doesn't quite fit this problem. "svnsync is a tool for creating and maintaining read-only mirrors of subversion repositories"
Ethan
Then maybe you should just set up an SSH tunnel into your office computer. That's probably what I would do.
Alex Fort
svnsync has MAJOR restrictions on its use. For instance, the one being synced to is a read-only mirror. You cannot commit things to it directly or you'll break it.
rmeador
SSH tunnel -- wish I could. But I.T. policy is no ssh connections from outside the LAN.
Ethan
The only type of connection allowed other than Web servers is GoToMyPC, but I can't really do serious work that way, and the connection is unreliable, sob sob.
Ethan
Ethan, I've updated my post about SSH tunnels below... they're outgoing, not incoming.
rmeador
+1  A: 

Take a look at Bazaar. It's rather less daunting than git, and has a useful-looking interface to Subversion repositories (via bzr-svn).

It will allow you to check out code from your Subversion repositories, develop independently (with local history), and check your code back in to Subversion as and when you need to.

Brent.Longborough
+2  A: 

I'd highly suggest your IT department set up a secure VPN, which would place you on their secure local network even when you're physically at another internet connection. It's incredibly tough to keep multiple-repo projects in sync.

As a workaround for an IT department that is not competent enough to do the right thing, Bazaar looks to be the easiest to use, most complete solution.

yaauie
+4  A: 

As a last-ditch effort, you can always poke a hole in your corporate firewall with SSH. Look into "ssh tunnels" (and also, come to think of it, "poke a hole in the firewall" might be a good search term too). I think you'll want either the -L or -R ssh option, but I can't recall which or even if they're the right ones for sure. And if you're running windows, it's still possible to use the same exact technique if you install Cygwin first.

EDIT: Sorry I wasn't more clear on how this works. The option you want is -R. It opens a port on the remote machine (for listening). When something connects to that port on the remote machine, the connection travels back down the SSH connection to the local machine, then is fowarded on to the server of your choice in the local network. You could connect to your home computer from your work computer before you leave at night with SSH to open the tunnel. Then when you're working from home, you set your SVN working copy (using svn switch --relocate) to point at your home computer. BTW, the SVN port is 3690 by default, if you're running the svnserve daemon.

rmeador
Thanks, sounds like that could work, but I.T. wouldn't allow it here.
Ethan
Oh, wait, I didn't understand. This is outgoing? OK, I'll look into it. Thanks.
Ethan
They really won't allow outgoing SSH connections? If you want to be sneaky, I you could set up your home SSH server to run on port 443, which is normally used for HTTPS. I bet your firewall will allow the connection, and because it's encrypted, they can't tell it isn't legit HTTP traffic (AFAIK).
rmeador
And another thing... there's a pretty good chance my suggestion (regardless of whether you run it on the traditional port of 22 or on 443) is a breach of your corporate network terms of use... just because it's possible doesn't mean it's allowed ;)
rmeador
Ethan unless you have "clout" with the business or IT heed rmeador's warning. Note if you had "clout" IT would have let you do one of the other ways. If your company hosts any kind of sensitive data like my ssn or my medical records you will and should get canned. Irrespective of talent.
jms
Was this finally the solution to OP's problem?
Felipe Alvarez
+1  A: 

Like meador said you could setup SSH tunnels to tunnel through your workstation in the office while you're at home, and gain access to the office SVN.

A great guide for setting up SSH on Windows can be found here: Cygwin SSH for Windows

I did this for a while to get remote desktop access until I was able to setup a proper SSH server with a port open on the firewall.

What you do is from your office workstation, make an SSH connection to your home machine, or optionally a dedicated home server. The parameters for that initial connection would provide a -R (remote) tunnel which is essentially allowing the remote machine to come back through the line on the specified port.

For example, if you issue the following command, all traffic which comes to port 1234 on the server will be forwarded to port 23 on the client. See Remote tunnel.

ssh2 -R 1234:: username@sshserver ^^ from SSH

Then on the home machine, you do something like svn://localhost:1234 and that would gain you access to SVN in the office.

*NOTE: I wouldn't recommend doing this without talking to your admins first, because they can get real touchy when you bypass their security... trust me, i know. ;-)

Adam
+1  A: 

I made a blog post about how to do something similar recently. I think this will work for you, except you will need to sync from your work place, unless you can tunnel through via ssh.

http://justinsboringpage.blogspot.com/2008/11/how-to-copy-svn-repository-from.html

Subversion has a tool called SVNSYNC to make it easy to sync from one repository to another. This is great when moving to a different web based server. In this example I'm copying a project I work on from Sourceforge to Google Code. Once done, the google code repository will be an exact mirror, including the complete change history.

You also need to set the revision number of the repository to zero. Google code, predictably, makes this easy, by having a button on the source page to do it for you.

You need to have your username and password for google code to do this. For the repository you're copying you don't. First you use the initial command to set things up for the copy, then use the sync command to do the actual copy. It does this one revision at a time and takes a while...

svnsync init https://lispbuilder.googlecode.com/svn https://lispbuilder.svn.sourceforge.net/svnroot/lispbuilderProject svnsync --username YOURNAME --password YOURPASSWORD sync https://lispbuilder.googlecode.com/svn https://lispbuilder.svn.sourceforge.net/svnroot/lispbuilder

justinhj
+1  A: 

In svn you can definitely set up a couple of repositories and then tie them together with the svn:externals command. I'm at home, so I can't remember the full details, but it's similar to using modules in CVS. You create a folder and set the properties on it to be a whole bunch of externals (that map to other higher folders in other repositories).

The ugly bit is that its messy to create branches and final versions, since the final folder with the properties isn't treated very well in the repository, but other than being a bit awkward it works well enough. We have the base code in one repository, and two other ones with instance-specific configurations. Checkout the right tag, and you get a fully merged project, ready for hacking. (It did work way better in CVS, yet another useful feature lost in time).

Paul.

Paul W Homer
+1  A: 

You need a Subversion replication system, such as Pushmi, or SVK as mentioned. If you can connect through your webservers, why don't you set SVN up with http access instead of svn? If ports are blocked, you can use mod_proxy to rewire a public url to the internal svn port.

However, if you're having to fight your IT department, then its all gone wrong already. You need to engage with them, preferably officially, to get them to support whatever policies you need to do your job. If you find yourself bypassing their systems, you're either going to get into trouble (eg. there may be perfectly valid reasons your corporate says no source code access outside the company, and its a disciplinary offence to do what you're trying) or your managers need to be made aware that IT isn't working for you.

gbjbaanb
+2  A: 

Short answer: no. You can't share history between repositories.

The long answer: This is a weakness of centralized systems like Subversion. Distributed version control solutions (like git) don't have this problem. Each "working copy" is a repository and commits can be made off-line and synched between repositories (or to a central "official" repository) at a later time.

What you'd need is some way to work locally on your computer with a local repository and sync changes back and forth when you are able. It just so happens that you've got a few options:

  • git includes git-svn which provides this kind of functionality. git has a learning curve, but this has improved with the 1.6.x series.

  • svk no longer seems to be very actively developed, but it does work reasonably well.It works very much like Subversion. It allows you to keep local mirrors of your official repositories, make commits to local branches on them and push those changes back to the official repository when you are able. It's not truly distributed in the same sense as git, but it's probably a better fit for your situation and less of a conceptual change than git.

bendin
just learned a little more about 'git' for your post. thx
Felipe Alvarez