views:

327

answers:

11

I've been using SVN for some time now, and am pretty happy with how it works (but I can't say I'm an expert, and I haven't really done much with branches and merging). However an opportunity has arisen to put in some new practises on a new team and so I thought I'd take a look at DVCSs to see if it's worth making the jump.

The company I work for is a pretty standard company where we all work in the same location (or sometimes at home) and we want to keep a central store of all code.

My question is: if all you are doing with a DVCS is creating a central hub that everyone pushes their changes to, is there really any benefit to moving to a DVCS and its extra overheads in this sort of environment?

+3  A: 

With DVCS's people can maintain their own local branches without making any changes in the central repository, and push their changes to the master repository when they think it's cooked up. Our project is stored in an SVN repository but personally I use git-svn to manage my local changes and find it quite useful, because we are not allowed to submit all the changes immediately(they have to be approved by the integrator first).

bad zeppelin
"With DVCS's people can maintain their own local branches without making any changes in the central repository" This can be seen as an advantage as well as a disadvantage.
sbi
I can totaly see the benefit of having a local verion history, but I can also see an issue of there being several features being "in development" being dotted around with emediate way of knowing what and where. But then maybe this is more down to project management.
Matt Brailsford
you would have that irresepctive of DVCS though surely? or do you check in half working stuff to SVN?
jk
@jk: Actually, I do. I frequently create (and destroy) feature branches for this purpose. The advantage of doing so with SVN is that it's all backed up with the SVN server's backup. The disadvantage is that it's all backed up with the SVN server's backup. `:)`
sbi
+3  A: 

Personally, I find it's a huge benefit. Even with a central repo, a DVCS changes the flow from "edit code, update from central, commit" to "edit code, commit, push to central". Among other things, that means that conflict resolution is far less stressful. It can also encourage development in smaller chunks, since you don't have to push after every commit. If your team is OK with it, that means your individual commits might leave the app in a strange state, as long as it's working when you finally push to the central repo. If they're not OK with that, as long as you're using git (or patch queues for hg, IIRC), you can still do dev in the same style, but then condense all your smaller commits into one larger commit that is complete before you push it to the central repo.

Hank Gay
+1  A: 
Michael Hackner
it looks like you don't use a dvcs yourself...
just somebody
+2  A: 

You'll get the inevitable war of Git vs. Mercurial starting here soon... :-) I personally use Mercurial, but what I've got to say should be suitable for all DVCS.

In my opinion, yes, they are suitable for corporate use. I use them at my own company, albeit with a small number of developers using it, but if you're worried about scalability, look at the large Open source projects using git and mercurial, e.g. Mozilla, Python.

The central hub approach works well - it's a familiar working model to users of subversion and you've always got a "definitive" version. Lock down access to this and apply any hooks to enforce commit policies and after that, developers have a large amount of freedom to work how they like with their local copies.

Another big plus is that I've found merging much less painful with mercurial than with subversion.

What's trickier with a DVCS is managing binary files - you can't require a lock on a binary file like you can with subversion (amongst others). Manage this with communication ideally.

Finally, cloning a repo is great for keeping checkouts in sync if you're working from several PCs.

Hope this helps. K

Kev
+1 though I'd say the war is largely over with hg-git
just somebody
+2  A: 

It all depends on how you want to work on projects. Distributed environments are great if everybody wants to build on its own branch. I prefer a central repository for my work (in a small team) as it makes the developers think about releasing one version of our product.

In my experience I see a lot of DVCS users who think of their own changes as the ones they don't have to review and these users review the changes of all other developers before merging them in their own tree. I like to see my changes as the change to the core product, so I review these changes before I commit them. As a result we try to keep the product pretty stable during the entire development cycle. Refactoring works OK, as we all update often.

Several DVCS users I know prefer to work on their feature on an independent tree and leave the integration with the central product to the final phase of their development. This works fine if the feature is independent, but I wouldn't like to be the one who has to integrate all the features developed this way with a deadline in sight.

If you integrate often, DVCS's don't differ much from central VCS's, and most DVCS's support a central repository, while more and more central VCS's support several features that where unique to DVCS's before, like offline commit and shelving.

(FYI: Offline commits are planned for Subversion 1.8)

Bert Huijben
The merging of a complete "feature" is definatley something that concerns me also. I know what it's like the longer you leave code un-commited in SVN. I guess it's just down to the definition of "feature" in that case, making sure it's not too big a commit.
Matt Brailsford
you push your changes when they are done but you should still be pulling in everybody elses changes regularly (at least daily imho) so there isn't a huge difference between your branch and others
jk
@jk @Matt: but if everyone else isn't pushing their changes because they are working like you are then you still end up with a big merge to do when someone does finally push.
Simon P Stevens
A: 

the overhead is not so big, in fact, in our environment, the added hg push is less of an overhead than commiting to the central svn repo was. but the biggest plus is all the bells and whistles that come with mercurial, that are great for an individual developer regardless of the team size or workflow. first and foremost, the fact that every wc is a repo is great, since you can experiment much more freely without polluting the master repo. then, there is functionality that builds on the wc == repo equality: bisect to quickly find the revision where a bug sneaked in, grep to, well, grep the history, as well as functionality simply missing from subversion, like colored diffs in the terminal.

just somebody
+2  A: 

The big benefit of using a DVCS for me is that I can commit to my local repository without having to share these changes with everyone else. So when working on a big change I do small incremental commits, meaning I can revert just the last 30 minutes work, or do a diff against a version that was working yesterday, but then only push to the central repository once all my work is complete.

I think this benefit alone is worth moving to a DVCS for.

However, using a DVCS does require a little more thought and understanding and using a "standard" version control system like SVN or CVS so you will need to consider the training overhead if moving to a DVCS or your central repository will end up full of a lot different branches people didn't realise they were creating.

Dave Webb
From your first paragraph - is this substantially different from creating your own development branch in SVN? I've not got into DCVS's yet so am curious to understand the difference.
Paolo
I guess it's not that different although I think you'll find when using a DVCS merging changes as much less painful, since the repository stores a history of change sets. My (limited) experience of merging with SVN is that it was an horrific, mostly manual process, although I could have been doing it wrong. When using Mercurial I found that merging my changes into the central repository was almost painless, with my intervention only required when there was a genuine conflict. I'm assuming git is the same.
Dave Webb
+1  A: 

Even with a hub workflow, a DVCS gets you the ability to make small commits locally, merge them only when you want to, and push them when they are ready.

With a non-DVCS, you are forced to either:

  1. do your work without committing, until it's polished and you push a huge commit.
  2. make small commits as you go, which everyone has to merge often, though merging intermediate commits brings them nothing of value.

And if you explore a dead end, without DVCS: with the first method, you can't rewind, you don't have a commit to go back to; with the second, both your commits and their reverts had to be merged pointlessly by everyone else.

Tobu
Would you not still have the issue of pushing a huge commit when you finish a local feature and want to push it to the hub?
Matt Brailsford
You should take advantage of your dvcs and make small commits instead of a big one. You do have to merge your small commits with the new commits on the hub, but you gain the ability to do so only when your commits are complete and ready to be tested.
Tobu
aren't the huge commits you push remotely a disadvantage?
Seun Osewa
Read more closely, the huge commits are a natural consequence of using a *centralised* VCS.
Tobu
A: 

Bazaar VCS can work as distributed VCS and as centralized VCS so you have the freedom to select the workflow you need. In the same time local private branches (where people can experiment while working on new features and in the same time commit their progress regularly) is huge benefit.

Also DVCS makes natural development workflow when mandatory code review required before new changes will be landed to trunk. This workflow (regarding SVN) described brilliantly in the UQDS article. And despite the fact that article described SVN-based workflow you'll find it more natural when you're using any DVCS instead of SVN, because in DVCS branching and merging is basic first-class operation.

bialix
+1  A: 

Personally i think the biggest advantage of DVCS is that you commit (locally) before merging, so if halfway through the merge it turns out to be more complex than you originally thought, it is trivial to get back to a clean state without losing your work. compare to CVCS where you usually have to merge succesfully before you can commit.

additional advantages include:

  • working from home/at clients site becomes easier as you don't require network connection just to check something in, and if you wait till back at base to push changes the history is preserved rather than lumping everything into one change.
  • Most DVCS operations are actually a lot faster as they don't need to pull data over the network
  • Some things (e.g. user settings scripts) are better shared directly between developers who want to share them rather than via a central location
jk
+1  A: 

In my experience there are several ways to use a DVCS inside a corporate environment:

  • Multi-site support: you've separated teams and you use your DVCS to set up different "servers" at each location so they're not limited by the underlying network problems (and believe me, there will be). It used to be done with "big things" like Clearcase Multi-site or Wandisco (for SVN/CVS) but now it's pretty doable with DVCS systems.

  • Support "roaming users": you're a corp. developer but you want to work at home for a certain time (or ever): instead of relying on the VPN you can have a DVCS at your laptop and then you're free to commit, review, diff, branch and merge without being slow down by the central server. You synch back when you're online or back at the office.

  • True "distributed development": which is the extreme case: each developer having his own DVCS (like you'd do on the OSS world). It will really depend on team's skills and motivation: if the team really wants to move into it, they'll benefit, otherwise it will be SYSADM's nightmare having to manage not a single repo but hundreds... with their corresponding issues.

pablo