canonpath usage on Windows

Dan Villiom Podlaski Christiansen danchr at gmail.com
Sun Nov 28 11:20:14 CST 2010


On 28 Nov 2010, at 15:39, Peer Sommerlund wrote:

> Hi list
>
> I have found what I guess is a bug in the usage of canonpath on  
> Windows.
>
> util.canonpath contains the line
>         name = os.path.join(root, cwd, name)
>
> On windows, if root and cwd both are absolute paths, then root is  
> thrown away.
>
> I'm testing patch branch pbackout from Aptana studio, and this cause  
> the canonpath to be called with
> root=C:\Users\Peer\src\my-repo
> cwd=C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Aptana
> myname=.hgpatchinfo/

This is correct. Relative paths are *always* interpreted relative to  
the current working directory. If you want to specify a path relative  
to the repository root without “being there”, you should use --cwd  
instead of --repo.

> In this case the above statement throws root away, and .hgpatchinfo  
> is never found, even though it is located at root.
>
> I was not able to determine which code calls canonpath, but I'm  
> pretty sure the code has left the pbranch extension calling  
> mercurial.patch.patch. My guess is somewhere between patch and  
> canonpath.
>
> I can reproduce the problem from the command line, where -- 
> repository is provided with a different location that current work  
> dir.
>
> cd C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Aptana
> hg pbackout --repository C:\Users\Peer\src\my-repo pgraph

This sounds like a bug in the pbranches extension. I'd suggest you  
report it to its author, Peter Arrenbrecht.

--

Dan Villiom Podlaski Christiansen
danchr at gmail.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20101128/60369b0f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1943 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20101128/60369b0f/attachment.bin>


More information about the Mercurial-devel mailing list