Having several people working over a SVN Repository
Let's say I am developing an application with a 开发者_如何学Pythoncouple of friends over a SVN(Subversion) repository. We are 5 and divided the work in 5 parts.
How should we proceed to develop things with subversion such as that every time someone feels like commiting(even if it doesn't compile), we don't incur in the problem of having a broken project in the repository?
Should each one create a branch over the central repository? How should we manage this? Also, there may me some times where we'll have to code in places with no internet connection, so it'd be a nice plus to be able to commit even in that situations.
Edit: this is a SUBVERSION question. no git/mercurial discussions here, please!
Branching is a good idea for creating new features. I've worked on software where we all developed on the main trunk and there were plenty of problems. Giving each feature its own branch will allow insulation and whenever you hit a major milestone you can merge that back into the head.
Being disconnected from the internet won't matter too much for you since you'll each be developing a separate piece. Pull down the latest from SVN before you lose internet and then when it's back up just commit your changes.
Edit: Also, as far as ensuring you don't have a broken trunk, you may want to consider executing unit tests at build time so that way you can ensure that nothing was broken by your changes before you commit.
Using subversion you can easily each work in your own branch and then just merge from and reintegrate to the trunk. More information can be found here
You can't commit when you do not have internet access using subversion, unless you use something like git as a local (to your machine) source control, and use git-svn to push/pull to/from your main subversion repository when you are back in coverage
If you have no internet connection, you need a distributed VCS, and svn
isn't one to my knowledge. Aformentioned git
is a very good distributed VCS.
If you're stuck with svn
, you can connect local git
repos to it to make it distributed. I do this for one of my projects. It gives you a lot of the benefits of git
, but it's a bit more tricky than the normal use of git
. See the git-svn
man
page for more information.
Particularly, see the "BASIC EXAMPLES" section.
# To create the local repo.
git svn clone http://svn.example.com/project/trunk
# Commit as usual:
git commit ...
# To push to SVN:
git svn fetch
git svn rebase
git svn dcommit
# Don't create branches in git. Create them in svn.
git svn branch branch_name
Update: Added usage cheat sheet.
So I would have a trunk and then 5 branches. Everyone checks into their branch and then once a day/week or whatever you guys get together and have everyones working branch merged into the trunk. As far as places with no internet connection then you should switch to git/merc which have some form of local repository.
Actually, your requirements lead directly to a use of a DVCS instead of Subversion. The exact problems you state (especially commiting while travelling/being offline) are resolved by any DVCS (e.g. git).
If you insist on using Subversion, you’ll have to use branches (we call such private development branches “workspaces” in our company) and merge them to the main branch when convenient. Committing while offline is, AFAICT, not really possible with Subversion. (I could imagine some overcomplicated way, which would be completely unmanagable and utterly useless in practice.) There used to be a nice tool working “on top” of SVN, called SVK, but it is no longer developed.
精彩评论