Traversing symlinks

Joel B. Mohler joel at
Fri May 20 05:44:50 CDT 2011

On Friday, May 20, 2011 06:00:35 am Dominik Psenner wrote:
> > 
> >
> > Maybe someone wants to make a deep path shorter by making a symlink. The
> > symlink may or may not be tracked, the point was just that Mercurial
> > behaves in an atypical way here compared to other Unix tools.
> hm I was more thinking of something like:
> $ hg init
> $ ln -s /etc
> $ hg add *
> $ hg commit
> At this point, I would expect mercurial to track the history of the data
> stored at the symlink location as if that data was physically there.

So this seems useful (in a gross kind of way) to version your /etc folder, but 
what happens when you clone and update this on another computer?  I would 
certainly hope it wouldn't overwrite your /etc.  What would you want to 

What about when someone else changes this repository and you re-update on your 
side?  I guess it will honor the symlink and update in your /etc.  I hope you 
never do an "hg purge".  All-in-all it seems rather opaque and scary to me.

I'm not sure why you would do this instead of versioning your /etc directory 
directly (which I already do).  I guess I'd better not do an 'hg purge' 
either, but all that seems much more obvious in a non-symlinked context.  Note 
that I'm rather selective about what I include in this repository and my /etc 
almost certainly includes symlinks whose ambient directories I've not been 
motivated to version yet.


More information about the Mercurial-devel mailing list