mercurial/dirstate.py
changeset 3628 63e173a4ffbc
parent 3607 f4c9bb4ad7b1
child 3842 47c634bf1e92
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: