Why is not platform specific 'realpath' used instead of 'os.path.realpath' ?

Mads Kiilerich mads at kiilerich.com
Thu Aug 9 05:30:48 CDT 2012


On 09/08/12 09:48, FUJIWARA Katsunori wrote:
> Hi, devels.
>
> I found that:
>
>    - platform specific 'realpath()' is defined in posix.py and
>      windows.py,
>
>    - 'os.path.realpath' is not replaced by it, so it should be used via
>      'util.realpath()', but
>
>    - there is no implementation using 'util.realpath()'
>
>      even though fixing about platform specific 'realpath()' were done
>      in 2009, 2010 and 2011:
>
>        - 40196d036a71
>        - e98bf6948092
>        - ab600a25dfc0
>
> Are there any historical/technical reasons not to use
> 'util.realpath()' ?
>
> If not, we should use 'util.realpath()' instead of
> 'os.path.realpath()', shouldn't we ?
>
> I just checked only 'realpath' symbol usage in current implementation,
> so please tell me if I overlook any important points.
>

Some digging shows that it was used in 
http://selenic.com/repo/hg/rev/26fa0e31011d but backed out again in 
http://selenic.com/repo/hg/rev/f6683a7011e9 .

It was discussed around 
http://www.selenic.com/pipermail/mercurial-devel/2011-October/ . It was 
fixed http://selenic.com/repo/hg/rev/ab600a25dfc0 and used 
http://selenic.com/repo/hg/rev/42630f54e513 and used everywhere 
http://selenic.com/repo/hg/rev/dbdb777502dc ... and all uses backed out 
again in http://selenic.com/repo/hg/rev/c519cd8f0169 .

Here be dragons!

But yes, all uses of os.path should IMO go away and be replaced by the 
VFS (or other means).

/Mads



More information about the Mercurial-devel mailing list