[issue1739] Alias paths can not be relative

Alban mercurial-bugs at selenic.com
Tue Jul 14 22:56:27 CDT 2009


New submission from Alban <alban at virtuos.com.cn>:

Hi,

I tried to create a relative path in my alias list (for global settings), 
like for example "..\MyRepoForCheck", because I have two repo next to each 
other in the same folder and I like to have the relative path in alias to 
avoid retyping it everytime I want to synchronize between both.

Although the alias is correctly saved in the mercurial.ini file, when I use 
it, the relative path is transformed in an absolute path that is definitly 
the wrong place. In my case it is transformed into "c:\Documents and 
Settings\MyRepoForCheck".

What I expect is to keep the relative path, that means I still expect to 
see "..\MyRepoForCheck" when I use the alias.

The precise code in Mercurial's ui.py

    def fixconfig(self, root=None):
        # translate paths relative to root (or home) into absolute paths
        root = root or os.getcwd()
        for c in self._tcfg, self._ucfg, self._ocfg:
            for n, p in c.items('paths'):
                if p and "://" not in p and not os.path.isabs(p):
                    c.set("paths", n, os.path.normpath(os.path.join(root, 
p)))

This change from relative to absolute path may be ok for the repo settings, 
but if you want to set a relative path in the global settings that doesn't 
make sense, because for the global settings there is no root path because 
no specific repository.

----------
messages: 10048
nosy: DannyWan
priority: bug
status: unread
title: Alias paths can not be relative

____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://mercurial.selenic.com/bts/issue1739>
____________________________________________________



More information about the Mercurial-devel mailing list