Adrian Panasiuk
Adrian Panasiuk

Reputation: 7343

svn: local commits

Subversion: is it possible to commit local revisions without pushing them, and push them at a later date - or is the lack of this feature why it's called "centralized" ?

Upvotes: 63

Views: 22286

Answers (9)

Sridhar Sarnobat
Sridhar Sarnobat

Reputation: 25216

The best solution I could think of without adding more revision control binaries is to just make a timestamped local copy of the file you don't want to appear in the central repository.

cp  my/changed/File.java  my/changed/File.java.`date -I`

I know this doesn't keep it "safe" but if you have a file with some modifications you want to push, and others you don't but want to keep for reference (e.g. for other approaches you tried), this might be the simplest workaround.

Upvotes: 0

arturh
arturh

Reputation: 6106

It is not possible to do local commits with Subversion.

This is because, as a centralized version control system, your local working copy does not have all the information the server has about past revisions, log entries, etc. which it would have had if it was a Distributed Version Control System (DVCS).

A subversion working copy contains a copy of all files as they were checked out so you can revert changed files without contacting the server.

If you really want to do local commits you should have a look at SVK, which is built on top of Subversion and provides DVCS like features.

Upvotes: 57

BobC
BobC

Reputation: 3490

Much of the above has become somewhat obsolete, and since this question comes up as a hit in a google search for "svn local commit" here's an update:

Consider using the package "git-svn" (along with "git-gui" if you don't know git) to make local commits both possible and easy, with full remote SVN integration. A decent overview/tutorial/use-case is here. I've just started using this process with Sourceforge projects, so I can't yet report any problems. Be sure to get the Authors file right!

EDIT: Updated link. Thanks, hdl!

Upvotes: 35

Seth
Seth

Reputation: 8373

Further to BobC's answer, for mercurial you would use hgsubversion.

Upvotes: 2

jon skulski
jon skulski

Reputation: 2305

As others have said, no.

I would strongly recommend trying to use anything remotely janky with svn.

I haven't used SVK enough to recommend against it, it seemed nice enough. However I am skeptical of using anything built on top of SVN for an entire project without anything breaking. I have use SVN enough to know that even regular work cycles can toast it if you're not careful.

We use SVN at work. I have been using bzr and bzr-svn to do all my interaction with and it works wonderfully. My workflow is something like:

$ bzr branch file:///var/svn/project ~/project

(hack, hack, hack)

$ bzr commit -m "commit log" (repeat)

when I'm ready

$ bzr push

Yes, instead of updating you have $ bzr merge and commit change (possibly shelving what you are working on) but local commits are a very nice thing, and shelving is too (shelving is like revert with a save)

I think git handles this as well. I've heard it is not as complete as bzr-svn, but I can not corroborate that.

But using a DVCS with a svn repository is a good way to go!

Upvotes: 2

Stobor
Stobor

Reputation: 45122

To get the best of both worlds, SVK was built on top of Subversion, but maintaining local state so you can do local commits...

Upvotes: 1

Gordon Childs
Gordon Childs

Reputation: 36072

No! git however can do this, and you can use git-svn to keep in sync with the original repository.

Upvotes: 1

Sideshowcoder
Sideshowcoder

Reputation: 656

You could do such a thing so if you interface the SVN Server with a GIT or Mercurial Bridge. Since GIT and Mercurial are able to do local Commits you could then use them like that. Maybe check out git-svn or something similiar (I remember there being a bazaar-svn but not sure).

Upvotes: 5

Manuel Ferreria
Manuel Ferreria

Reputation: 1232

That is why it is called centralized. You could try using a repo inside a repo. One is local and the other is remote. You then commit the entire inner repository to the remote.

Upvotes: 3

Related Questions