mercurial/hg.py
changeset 726 809a870a0e73
parent 725 c6b912f8b5b2
child 730 d2dc7663d512
equal deleted inserted replaced
725:c6b912f8b5b2 726:809a870a0e73
   432                             ds = os.path.join(d, sd +'/')
   432                             ds = os.path.join(d, sd +'/')
   433                             if self.ignore(ds) or not match(ds):
   433                             if self.ignore(ds) or not match(ds):
   434                                 subdirs.remove(sd)
   434                                 subdirs.remove(sd)
   435                         for fn in fl:
   435                         for fn in fl:
   436                             fn = util.pconvert(os.path.join(d, fn))
   436                             fn = util.pconvert(os.path.join(d, fn))
   437                             yield fn
   437                             yield 'f', fn
   438                 else:
   438                 else:
   439                     yield f[len(self.root) + 1:]
   439                     yield 'f', f[len(self.root) + 1:]
   440 
   440 
   441             for k in dc.keys():
   441             for k in dc.keys():
   442                 yield k
   442                 yield 'm', k
   443 
   443 
   444         # yield only files that match: all in dirstate, others only if
   444         # yield only files that match: all in dirstate, others only if
   445         # not in .hgignore
   445         # not in .hgignore
   446 
   446 
   447         for fn in util.unique(traverse()):
   447         for src, fn in util.unique(traverse()):
   448             if fn in dc:
   448             if fn in dc:
   449                 del dc[fn]
   449                 del dc[fn]
   450             elif self.ignore(fn):
   450             elif self.ignore(fn):
   451                 continue
   451                 continue
   452             if match(fn):
   452             if match(fn):
   453                 yield fn
   453                 yield src, fn
   454 
   454 
   455     def changes(self, files = None, match = util.always):
   455     def changes(self, files = None, match = util.always):
   456         self.read()
   456         self.read()
   457         dc = self.map.copy()
   457         dc = self.map.copy()
   458         lookup, changed, added, unknown = [], [], [], []
   458         lookup, changed, added, unknown = [], [], [], []
   459 
   459 
   460         for fn in self.walk(files, match):
   460         for src, fn in self.walk(files, match):
   461             try: s = os.stat(os.path.join(self.root, fn))
   461             try: s = os.stat(os.path.join(self.root, fn))
   462             except: continue
   462             except: continue
   463 
   463 
   464             if fn in dc:
   464             if fn in dc:
   465                 c = dc[fn]
   465                 c = dc[fn]
   838         if not self.hook("commit", node=hex(n)):
   838         if not self.hook("commit", node=hex(n)):
   839             return 1
   839             return 1
   840 
   840 
   841     def walk(self, node = None, files = [], match = util.always):
   841     def walk(self, node = None, files = [], match = util.always):
   842         if node:
   842         if node:
   843             change = self.changelog.read(node)
   843             for fn in self.manifest.read(self.changelog.read(node)[0]):
   844             fns = filter(match, self.manifest.read(change[0]))
   844                 yield 'm', fn
   845         else:
   845         else:
   846             fns = self.dirstate.walk(files, match)
   846             for src, fn in self.dirstate.walk(files, match):
   847         for fn in fns: yield fn
   847                 yield src, fn
   848 
   848 
   849     def changes(self, node1 = None, node2 = None, files = [],
   849     def changes(self, node1 = None, node2 = None, files = [],
   850                 match = util.always):
   850                 match = util.always):
   851         mf2, u = None, []
   851         mf2, u = None, []
   852 
   852