mercurial/hg.py
changeset 887 882756761433
parent 885 6594ba2a0f51
parent 886 509de8ab6f31
child 890 391de0bcc722
equal deleted inserted replaced
885:6594ba2a0f51 887:882756761433
   310             bigpat = []
   310             bigpat = []
   311             try:
   311             try:
   312                 l = file(self.wjoin(".hgignore"))
   312                 l = file(self.wjoin(".hgignore"))
   313                 for pat in l:
   313                 for pat in l:
   314                     if pat != "\n":
   314                     if pat != "\n":
   315                         p = util.pconvert(pat[:-1])
   315 			p = pat[:-1]
   316                         try:
   316                         try:
   317                             r = re.compile(p)
   317                             re.compile(p)
   318                         except:
   318                         except:
   319                             self.ui.warn("ignoring invalid ignore"
   319                             self.ui.warn("ignoring invalid ignore"
   320                                          + " regular expression '%s'\n" % p)
   320                                          + " regular expression '%s'\n" % p)
   321                         else:
   321                         else:
   322                             bigpat.append(util.pconvert(pat[:-1]))
   322                             bigpat.append(p)
   323             except IOError: pass
   323             except IOError: pass
   324 
   324 
   325             if bigpat:
   325             if bigpat:
   326                 s = "(?:%s)" % (")|(?:".join(bigpat))
   326                 s = "(?:%s)" % (")|(?:".join(bigpat))
   327                 r = re.compile(s)
   327                 r = re.compile(s)
   499                         inst.strerror))
   499                         inst.strerror))
   500                     continue
   500                     continue
   501                 if stat.S_ISDIR(st.st_mode):
   501                 if stat.S_ISDIR(st.st_mode):
   502                     for dir, subdirs, fl in os.walk(f):
   502                     for dir, subdirs, fl in os.walk(f):
   503                         d = dir[len(self.root) + 1:]
   503                         d = dir[len(self.root) + 1:]
   504                         nd = os.path.normpath(d)
   504                         nd = util.normpath(d)
   505                         if seen(nd):
   505                         if seen(nd):
   506                             subdirs[:] = []
   506                             subdirs[:] = []
   507                             continue
   507                             continue
   508                         for sd in subdirs:
   508                         for sd in subdirs:
   509                             ds = os.path.join(nd, sd +'/')
   509                             ds = os.path.join(nd, sd +'/')
   534 
   534 
   535         # yield only files that match: all in dirstate, others only if
   535         # yield only files that match: all in dirstate, others only if
   536         # not in .hgignore
   536         # not in .hgignore
   537 
   537 
   538         for src, fn in util.unique(traverse()):
   538         for src, fn in util.unique(traverse()):
   539             fn = os.path.normpath(fn)
   539             fn = util.normpath(fn)
   540             if seen(fn): continue
   540             if seen(fn): continue
   541             if fn not in dc and self.ignore(fn):
   541             if fn not in dc and self.ignore(fn):
   542                 continue
   542                 continue
   543             if match(fn):
   543             if match(fn):
   544                 yield src, fn
   544                 yield src, fn