comparison mercurial/dirstate.py @ 4232:0d51eb296fb9

Merge with crew-stable
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 16 Mar 2007 00:45:18 -0300
parents dbc3846c09a1 c93562fb12cc
children fe0fe0b4d73b
comparison
equal deleted inserted replaced
4224:2a8b6d78d7ee 4232:0d51eb296fb9
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 # self.root ends with a path separator if self.root is '/' or 'C:\' 35 # self.root ends with a path separator if self.root is '/' or 'C:\'
36 common_prefix_len = len(self.root) 36 rootsep = self.root
37 if not self.root.endswith(os.sep): 37 if not rootsep.endswith(os.sep):
38 common_prefix_len += 1 38 rootsep += os.sep
39 return cwd[common_prefix_len:] 39 if cwd.startswith(rootsep):
40 return cwd[len(rootsep):]
41 else:
42 # we're outside the repo. return an absolute path.
43 return cwd
40 44
41 def hgignore(self): 45 def hgignore(self):
42 '''return the contents of .hgignore files as a list of patterns. 46 '''return the contents of .hgignore files as a list of patterns.
43 47
44 the files parsed for patterns include: 48 the files parsed for patterns include:
359 elif stat.S_ISBLK(st.st_mode): kind = _('block device') 363 elif stat.S_ISBLK(st.st_mode): kind = _('block device')
360 elif stat.S_ISFIFO(st.st_mode): kind = _('fifo') 364 elif stat.S_ISFIFO(st.st_mode): kind = _('fifo')
361 elif stat.S_ISSOCK(st.st_mode): kind = _('socket') 365 elif stat.S_ISSOCK(st.st_mode): kind = _('socket')
362 elif stat.S_ISDIR(st.st_mode): kind = _('directory') 366 elif stat.S_ISDIR(st.st_mode): kind = _('directory')
363 self.ui.warn(_('%s: unsupported file type (type is %s)\n') % ( 367 self.ui.warn(_('%s: unsupported file type (type is %s)\n') % (
364 util.pathto(self.getcwd(), f), 368 util.pathto(self.root, self.getcwd(), f),
365 kind)) 369 kind))
366 return False 370 return False
367 371
368 def walk(self, files=None, match=util.always, badmatch=None): 372 def walk(self, files=None, match=util.always, badmatch=None):
369 # filter out the stat 373 # filter out the stat
469 found = True 473 found = True
470 break 474 break
471 if not found: 475 if not found:
472 if inst.errno != errno.ENOENT or not badmatch: 476 if inst.errno != errno.ENOENT or not badmatch:
473 self.ui.warn('%s: %s\n' % ( 477 self.ui.warn('%s: %s\n' % (
474 util.pathto(self.getcwd(), ff), 478 util.pathto(self.root, self.getcwd(), ff),
475 inst.strerror)) 479 inst.strerror))
476 elif badmatch and badmatch(ff) and imatch(nf): 480 elif badmatch and badmatch(ff) and imatch(nf):
477 yield 'b', ff, None 481 yield 'b', ff, None
478 continue 482 continue
479 if stat.S_ISDIR(st.st_mode): 483 if stat.S_ISDIR(st.st_mode):