[MERGE] Implement hard-link support for branch and checkout

Aaron Bentley aaron.bentley at utoronto.ca
Thu Dec 20 22:06:35 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Arbash Meinel wrote:
> I'm pretty hesitant to support hardlinking working tree files. It just seems to
> easy to mess up the wrong files. I could understand hardlinking .bzr/* files
> when reasonable, because people won't edit them.

I think it's a lot easier to break stuff by hardlinking .bzr
directories.  One unaware client could cause repository corruption.  And
with Arch, hardlinked revision libraries or working trees frequently did
have this problem, especially when it came to file modes.

But with Bazaar and working tree files, I think the worst that can
happen is that the change goes into the wrong place.  It will be quite
visible when the user runs status or diff, and we've got "revert" and
"shelve" to recover from situations like that.

> I know I had vim set up to break hardlinks because of Arch. But I've since
> removed that because I like editing ~/bin/foo which is often a symlink, and I
> don't want vim breaking my symlinks.

Apparently vim can now be configured to break only hardlinks, by setting
backupcopy=breakhardlink.

> If we are going to do it, we need to watch out for crossing filesystems.

Well, if the user tries it and it fails, they can just try again without
- --hardlink, right?

> The code I've seen before used something like:
> 
> try:
>   os.link
> except ???:
>   os.copy()
> 
> So it transparently handled whether the hardlinks were crossing filesystems.

I don't think we need that level of sophistication.  Either the whole
workingtree can be hardlinked, or none of it can.  And if it can't, then
the user can choose not to do it.

> I suppose if someone is explicitly requesting it....

No one is explicitly requesting it, but I think larger projects like
OpenOffice or Firefox might expect it.  I want to encourage people to
make feature branches, but if every branch requires creating a fresh
copy of every file in the source tree, I think that's not an acceptable
price in a large project.

And of course, other DVCSes do support it.

My recent acceleration work was initially sparked by the notion of doing
hardlinks because I expected hard links to be much faster.  But I broke
it into logical steps, and discovered you don't need hard links to reap
most of the speed benefits.  Don't mean they're a bad idea, though.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHaudr0F+nu1YWqI0RApgwAJ41FjH2v91rqRRi9l6BVk8pCCWo6gCdHBHX
/Tj7agJ6lvlS07zc9i83hio=
=Lkyi
-----END PGP SIGNATURE-----



More information about the bazaar mailing list