hgkw/keyword.py
changeset 272 02d012b9dd56
parent 271 35f43e2ce5b6
child 273 a283665ad7cd
equal deleted inserted replaced
271:35f43e2ce5b6 272:02d012b9dd56
   319     wlock = lock = None
   319     wlock = lock = None
   320     try:
   320     try:
   321         wlock = repo.wlock()
   321         wlock = repo.wlock()
   322         lock = repo.lock()
   322         lock = repo.lock()
   323         files, match, anypats = cmdutil.matchpats(repo, pats, opts)
   323         files, match, anypats = cmdutil.matchpats(repo, pats, opts)
       
   324         fdict = dict.fromkeys(files)
       
   325         fdict.pop('.', None)
   324         ctx = repo.changectx()
   326         ctx = repo.changectx()
   325         node = ctx.node()
       
   326         man = ctx.manifest()
   327         man = ctx.manifest()
   327         try:
   328         mfiles = man.keys()
   328             files = [f for src, f
   329         mfiles.sort()
   329                      in repo.walk(node=node, files=files, match=match)
   330         files = []
   330                      if ui.kwfmatcher(f) and not man.linkf(f)]
   331         
   331         except AttributeError:
   332         def iskwfile(f):
   332             _kwbailout(ui)
   333             try:
       
   334                 return ui.kwfmatcher(f) and not man.linkf(f)
       
   335             except AttributeError:
       
   336                 _kwbailout(ui)
       
   337 
       
   338         for f in mfiles:
       
   339             for ff in fdict:
       
   340                 if ff == f or ff.startswith('%s/' % f):
       
   341                     if iskwfile(ff):
       
   342                         files.append(ff)
       
   343                     del fdict[ff]
       
   344                     break
       
   345             if not f in files and match(f) and iskwfile(f):
       
   346                 files.append(f)
   333         if files:
   347         if files:
   334             kwt = kwtemplater(ui, repo, expand, node=node)
   348             kwt = kwtemplater(ui, repo, expand, node=ctx.node())
   335             # 3rd argument sets commit to False
   349             # 3rd argument sets commit to False
   336             kwt.overwrite(files, man, False)
   350             kwt.overwrite(files, man, False)
   337     finally:
   351     finally:
   338         del wlock, lock
   352         del wlock, lock
   339 
   353