mercurial/dirstate.py
changeset 4230 c93562fb12cc
parent 4229 24c22a3f2ef8
child 4232 0d51eb296fb9
child 4330 1b9fc3f48861
equal deleted inserted replaced
4229:24c22a3f2ef8 4230:c93562fb12cc
    32 
    32 
    33     def getcwd(self):
    33     def getcwd(self):
    34         cwd = os.getcwd()
    34         cwd = os.getcwd()
    35         if cwd == self.root: return ''
    35         if cwd == self.root: return ''
    36         # self.root ends with a path separator if self.root is '/' or 'C:\'
    36         # self.root ends with a path separator if self.root is '/' or 'C:\'
    37         common_prefix_len = len(self.root)
    37         rootsep = self.root
    38         if not self.root.endswith(os.sep):
    38         if not rootsep.endswith(os.sep):
    39             common_prefix_len += 1
    39             rootsep += os.sep
    40         return cwd[common_prefix_len:]
    40         if cwd.startswith(rootsep):
       
    41             return cwd[len(rootsep):]
       
    42         else:
       
    43             # we're outside the repo. return an absolute path.
       
    44             return cwd
    41 
    45 
    42     def hgignore(self):
    46     def hgignore(self):
    43         '''return the contents of .hgignore files as a list of patterns.
    47         '''return the contents of .hgignore files as a list of patterns.
    44 
    48 
    45         the files parsed for patterns include:
    49         the files parsed for patterns include: