Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/dirstate.py @ 3628: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 | f4c9bb4ad7b1 |
children | 47c634bf1e92 |
comparison
equal
deleted
inserted
replaced
3627:cabe62800120 | 3628:63e173a4ffbc |
---|---|
30 return os.path.join(self.root, f) | 30 return os.path.join(self.root, f) |
31 | 31 |
32 def getcwd(self): | 32 def getcwd(self): |
33 cwd = os.getcwd() | 33 cwd = os.getcwd() |
34 if cwd == self.root: return '' | 34 if cwd == self.root: return '' |
35 return cwd[len(self.root) + 1:] | 35 # self.root ends with a path separator if self.root is '/' or 'C:\' |
36 common_prefix_len = len(self.root) | |
37 if not self.root.endswith(os.sep): | |
38 common_prefix_len += 1 | |
39 return cwd[common_prefix_len:] | |
36 | 40 |
37 def hgignore(self): | 41 def hgignore(self): |
38 '''return the contents of .hgignore files as a list of patterns. | 42 '''return the contents of .hgignore files as a list of patterns. |
39 | 43 |
40 the files parsed for patterns include: | 44 the files parsed for patterns include: |