- Change Summary:
-
Fix description.
- Description:
-
Fix ClearCase unextend_path() on Windows.
The ntpath in Python behaves in the following manner:
ntpath.join('c:', 'dir', 'file')
'c:dir\file'os.chdir('C:\Windows')
ntpath.realpath(ntpath.join('C:', 'dir', 'file'))
'C:\Windows\dir\file'os.chdir('C:\Windows')
ntpath.realpath(ntpath.join('C:\', 'dir', 'file'))
'C:\dir\file'ntpath.realpath(ntpath.join('/', 'computer', 'share', 'file'))
'C:\computer\share\file'ntpath.realpath(ntpath.join('\\', 'computer', 'share', 'file'))
'\\computer\share\file'The unextended_chunks[0] in case of repository on local drive is 'X:' where X is the drive letter, and in case of UNC path is '/'.
Change the unextended_chunks[0] so the returned realpath is correct. This both makes the displayed path proper and resolves the "ValueError: Cannot mix UNC and non-UNC paths" when Clear Case repository is configured with UNC path.
Fix ClearCase unextend_path() on Windows.
Review Request #3321 — Created Sept. 5, 2012 and submitted
Fix ClearCase unextend_path() on Windows.
The ntpath in Python behaves in the following manner:
>>> ntpath.join('c:', 'dir', 'file')
'c:dir\\file'
>>> os.chdir('C:\\Windows')
>>> ntpath.realpath(ntpath.join('C:', 'dir', 'file'))
'C:\\Windows\\dir\\file'
>>> os.chdir('C:\\Windows')
>>> ntpath.realpath(ntpath.join('C:\\', 'dir', 'file'))
'C:\\dir\\file'
>>> ntpath.realpath(ntpath.join('/', 'computer', 'share', 'file'))
'C:\\computer\\share\file'
>>> ntpath.realpath(ntpath.join('\\\\', 'computer', 'share', 'file'))
'\\\\computer\\share\\file'
The unextended_chunks[0] in case of repository on local drive is 'X:' where X is the drive letter, and in case of UNC path is '/'.
Change the unextended_chunks[0] so the returned realpath is correct.
This both makes the displayed path proper and resolves the "ValueError: Cannot mix UNC and non-UNC paths" when Clear Case repository is configured with UNC path.
Tested on production 1.6.11 installation.
DE