Mercurial > hg > hgforest
changeset 5:7648fb26fde9
symbolic links as nested tree roots
For each nested tree represented by a symbolic link, record the path
to the link in snapshots but follow the link to apply Mercurial
commands to the actual repository.
The 'fclone' or 'fseed' commands do not preserve symbolic links, they
create a directory instead. One consequence of this is that if a
forest contains more than one path to the same repository, a clone of
this forest or a forest populated based on a snapshot of it will
contain more than one copy of the original repository.
Thanks to "Eric Bloodworth" <ergosys@gmail.com> for reporting this.
author | Robin Farine <robin.farine@terminus.org> |
---|---|
date | Sat, 22 Jul 2006 01:08:39 +0200 |
parents | 5b9d129c02f2 |
children | a41d82517c45 |
files | forest.py |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/forest.py Sat Jul 22 00:14:46 2006 +0200 +++ b/forest.py Sat Jul 22 01:08:39 2006 +0200 @@ -31,13 +31,12 @@ import sys import mercurial.node -from mercurial import commands, util +from mercurial import commands, hg, util try: # 'find' renamed as 'findcmd' after Mercurial 0.9 from mercurial.commands import findcmd except: from mercurial.commands import find as findcmd -from mercurial.hg import repository from mercurial.i18n import gettext as _ from mercurial.repo import RepoError @@ -86,6 +85,14 @@ return True return False +def repository(ui, root): + while os.path.islink(root): + path = os.readlink(root) + if not os.path.isabs(path): + path = os.path.join(os.path.dirname(root), path) + root = path + return hg.repository(ui, root) + class ForestSnapshot(object):