Re: [viewvc-dev] r2674 (Fix annotate views using urllib.pathname2url) breaks annotate on windows

Jens Peters <[email protected]> Fri, 06 Jan 2012 21:23:49 +0100
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Message-ID <[email protected]>
On 5-1-2012 16:02, C. Michael Pilato wrote:
> On 01/04/2012 03:13 PM, Jens Peters wrote:
>> Thanks for committing r2710. The attached patch resolves the path issue for
>> me. What do you think?
> Does that patch actually make a difference?  I wouldn't expect it change
> anything when you provide an absolute rootpath to the function.  Just for
> the sake of my own understanding of how this code works on Windows, can you
> show me how your patch changes the values of "drive" and "rootpath" for your
> situation?
>
Sure.
My patch:
-> rootpath    str: D:\\var\\svn\\repos\\misc

rootpath = os.path.abspath(rootpath)
-> rootpath    str: D:\\var\\svn\\repos\\misc

drive, rootpath = os.path.splitdrive(rootpath)
-> drive    str: D:
-> rootpath    str: \\var\\svn\\repos\\misc

if os.sep != '/':
   rootpath = string.replace(rootpath, os.sep, '/')
-> rootpath    str: /var/svn/repos/misc

rootpath = urllib.quote(rootpath)
-> rootpath    str: /var/svn/repos/misc

Original version:
-> rootpath    str: D:\\var\\svn\\repos\\misc

drive, rootpath = os.path.splitdrive(rootpath)
-> drive    str: D:
-> rootpath    str: \\var\\svn\\repos\\misc

rootpath = os.path.abspath(rootpath)
-> rootpath    str: D:\\var\\svn\\repos\\misc

if os.sep != '/':
   rootpath = string.replace(rootpath, os.sep, '/')
-> rootpath    str: D:/var/svn/repos/misc

rootpath = urllib.quote(rootpath)
-> rootpath    str: D%3A/var/svn/repos/misc

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=2906623

To unsubscribe from this discussion, e-mail: [[email protected]].