views:

348

answers:

6

I've checked out a copy of a project hosted on google code. I'm going to be making changes to it, and I'd like to keep these under version control on a repository on my local machine.

I'd like to use svn if possible, because I already know the very basics of creating a repository, checking out and committing.

Can I do this with svn or should I be looking at distibuted version control? I'm using Linux, not Windows.

+3  A: 

YES! Please do use a version control tool. SVN is very simple to use, so I suggest that.

One thing that might be useful is that you could use Eclipse + PyDev (for python) + Subeclipse (for your SVN). This should be a nice platform independent stack, that wins you a gui-enabled SVN client. Be sure to check out the plugin Mylyn that comes with most of the Eclipse packages - it really is awesome.

An alternative for you windows users is TortoiseSVN - follow their tutorial to create a repository.

The easiest for a single user is using the "File" protocol. Slightly harder is setting up a proper SVN server, which you might want to put off until you understand SVN better - it lets you work from multiple machines.

Tom Leys
The repository is going to live on my webhost's server, so I need to get my hands dirty with the command line. Having said that, I've used TortoiseSVN on Windows, and the gui is very convenient. I'll check out Subeclipse at somepoint. Thanks for the tip!
Alasdair
+5  A: 

I've been very happy using svn against a remote repository + using mercurial or git as a local repository on top of the svn repo.

They're both distributed source control tools, and I like them both for slightly different reasons.

I've found it to be very powerful to use my own local repo that coincides with a remote subversion repository...

Update

Although I really like the answers about exporting from google code, and importing to your local repo, what I really like about the combination of svn and git/mercurial is that you can periodically do an svn update to get the latest code from google, and then to a git commit or an hg commit to add the latest code to your local repo.

Much simpler than periodically doing an svn export into your repo to get updates.

Additionally, using git/mercurial, you have powerful branching/patching tools available that svn doesn't make so easy.

John Weldon
I can see why combining git and svn is perhaps a more elegant solution. But in this case, sticking with svn is good enough, and let me get back to coding quicker. I'll try git/mercurial in future.
Alasdair
'In future' turned out to be a few days later. This answer works very well for me.
Alasdair
+1  A: 

svn commit will commit your changes to the (remote) repository. If you want to check-in locally before pushing to the remote repository (if at all), then a distributed tool like git or mercurial is what you want.

pgs
+2  A: 

SVN is a very good version control system. It is used in many important projects and is also easy to use while at the same time has powerful options.

If your local copy is pointing to google code. You can do an export, which essentially takes out the version control information and then import it to your local SVN.

This meas you will loose all previous history and will start from scratch and have history from then on, of the changes you make locally and commit to your SVN.

If you need to keep the history of all commits in google code to this point in your local SVN, then let us know as this can be done.

If you also need to at some point commit your local code back to google code, then let us know too, to explain how to do that.

Hope this helps.

jvanderh
Bingo! Export is the concept I needed but didn't know the name of. Thanks!
Alasdair
+1  A: 

Yes.

You can create your local repository using

svnadmin create repositoryName

And then you can do your first checkout using the regular svn commands.

svn checkout file:///path/to/your/repositoryName

Just make sure that you actually do an export of the project you've obtained via google code and not a svn checkout. Otherwise you'll run into trouble with .svn files already existing for another repository. Take all the files you've obtained from your export and move them to your newly created local copy, add all files to svn and commit.

When you want to port your changes, simply

svn update

the directory that contain a checked out version of the google code repository, overwrite all the files you've changed (or use diffs to make the changes) then commit back to the repository.

tomzx
+1  A: 
svnadmin create project-local-repo
svn checkout file:///path/to/project-local-repo project-branch
svn export http://PROJECT.googlecode.com/svn/trunk/ project-branch

This will (should) create a new repository in project-local-repo on your machine for your branch, and checkout from that repository into the project-branch folder. Then it will export a clean copy of the files from the main repo into your project-branch folder. Then you just need to add those files to the (local) repo and commit and you should be good to go. This is entirely untested and hypothetical though..

Nick Lewis
Fixed it, thanks for the heads up. I use TortoiseSVN myself, so I don't know all the REAL commands so well. :)
Nick Lewis