views:

168

answers:

4

When I first found out that Mercurial tracked files and not directories, I was a bit disappointed. (This means you can't represent an empty directory in the repo.) However, it doesn't seem to be an issue in practice, and makes some things a tad easier for me. How about other SCM systems? (Edit this post to add them.) What advantages or disadvantages have you found by not tracking directories? (Each one separately in an answer, please.)

Do track directories:

  • Subversion
  • Bazaar/bzr
  • PlasticSCM
  • Accurev
  • Clearcase
  • (add one!)

Do NOT track directories:

  • Mercurial/hg
  • git
  • (add one!)
+2  A: 

This is from the Mercurial book:

Empty directories are rarely useful, and there are unintrusive workarounds that you can use to achieve an appropriate effect. The developers of Mercurial thus felt that the complexity that would be required to manage empty directories was not worth the limited benefit this feature would bring.

I think it pretty much says it all. If you design a VCS, you make some decisions. In Mercurial's case, the decisions on file handling (that per se can probably be considered good) lead to this small caveat.

It can definitely be considered a flaw, however a small one. Other VCSs have other flaws coming from other decisions (the constantly needed cleanup operations in git, for example, that don't make git worth any less).

balpha
I know there are tradeoffs. This question is about finding out how those tradeoffs affect real users in real projects. The nature of SO means we can see which issues affect (or at least are important to) this community more (by votes).
Roger Pate
That's fine, and my answer will probably stay on the bottom. I'm totally okay with that, I just thought it was good to point out. I know it's not a real answer to your question, but it's a CW, so I took the freedom :-)
balpha
Thanks for participating, just didn't want you to misunderstand the question if you took the time to answer. :)
Roger Pate
+2  A: 

No surprise that git doesn't do empty directories. It did surprise me that bzr does track them however.

An easy workaround that has been with us since CVS days is to create a placeholder file in the directory and track that. Alternatively you can create the empty directory in the build process, which is almost always the right thing to do anyway.

rq
+1 do it in the build. I was looking for semi-standard method for tracking directories in mercurial. Doing it in the build turned out to be much more elegant solution.
caspin
+1  A: 

I've been facing the issue with empty directories, too. The problem with using placeholder files is that you need to create them, and delete them, if they are not necessary anymore (because later on there were added sub-directories or files. With big source trees managing these placeholder files can be cumbersome and error prone.

A: 

Add: DO track directories: Plastic SCM, Accurev

pablo
It's community wiki you can add them yourself. I don't mean that to sound as petulant as it does.
caspin