Mercurial > hg
changeset 3665:63e173a4ffbc
issue228: Fix repositories at the filesystem root (/ or C:\)
Thanks to Robert Shaw and other people on the list for the suggestions.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Thu, 09 Nov 2006 21:53:45 +0100 |
parents | cabe62800120 |
children | adbf440a81e0 |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Wed Nov 08 11:28:33 2006 -0800 +++ b/mercurial/dirstate.py Thu Nov 09 21:53:45 2006 +0100 @@ -32,7 +32,11 @@ def getcwd(self): cwd = os.getcwd() if cwd == self.root: return '' - return cwd[len(self.root) + 1:] + # self.root ends with a path separator if self.root is '/' or 'C:\' + common_prefix_len = len(self.root) + if not self.root.endswith(os.sep): + common_prefix_len += 1 + return cwd[common_prefix_len:] def hgignore(self): '''return the contents of .hgignore files as a list of patterns.