hgkw/keyword.py
branchkwmap-templates
changeset 99 f881ecdcdec9
parent 97 9353e7ce6d9b
child 100 4f1129ddbdb8
equal deleted inserted replaced
97:9353e7ce6d9b 99:f881ecdcdec9
   184     # above line for backwards compatibility; can be changed to
   184     # above line for backwards compatibility; can be changed to
   185     #   from mercurial.i18n import _
   185     #   from mercurial.i18n import _
   186     # some day
   186     # some day
   187     from mercurial import commands
   187     from mercurial import commands
   188 
   188 
   189     if hooktype != 'pretxncommit':
       
   190         return True
       
   191 
       
   192     cmd, sysargs, globalopts, cmdopts = commands.parse(ui, sys.argv[1:])[1:]
   189     cmd, sysargs, globalopts, cmdopts = commands.parse(ui, sys.argv[1:])[1:]
   193     if repr(cmd).split()[1] in ('tag', 'import_'):
   190     if repr(cmd).split()[1] in ('tag', 'import_'):
   194         return False
   191         return
   195 
   192 
   196     files, match, anypats = cmdutil.matchpats(repo, sysargs, cmdopts)
   193     files, match, anypats = cmdutil.matchpats(repo, sysargs, cmdopts)
   197     modified, added = repo.status(files=files, match=match)[:2]
   194     modified, added = repo.status(files=files, match=match)[:2]
   198     candidates = kwfmatches(ui, repo, modified+added)
   195     candidates = kwfmatches(ui, repo, modified+added)
   199     if not candidates:
   196     if not candidates:
   200         return False
   197         return
   201 
   198 
   202     kwt = kwtemplater(ui, repo, node=repo.changelog.tip())
   199     kwt = kwtemplater(ui, repo, node=repo.changelog.tip())
   203     for f in candidates:
   200     for f in candidates:
   204         data = repo.wfile(f).read()
   201         data = repo.wfile(f).read()
   205         if not util.binary(data):
   202         if not util.binary(data):