hgkw/keyword.py
branch0.9.2compat
changeset 458 dd5eca480af6
parent 453 0804ead55da7
child 462 f65280d03582
equal deleted inserted replaced
453:0804ead55da7 458:dd5eca480af6
   407         raise util.Abort(_('[keyword] patterns cannot match'))
   407         raise util.Abort(_('[keyword] patterns cannot match'))
   408     raise util.Abort(_('no [keyword] patterns configured'))
   408     raise util.Abort(_('no [keyword] patterns configured'))
   409 
   409 
   410 def _kwfwrite(ui, repo, expand, *pats, **opts):
   410 def _kwfwrite(ui, repo, expand, *pats, **opts):
   411     '''Selects files and passes them to kwtemplater.overwrite.'''
   411     '''Selects files and passes them to kwtemplater.overwrite.'''
       
   412     if repo.dirstate.parents()[1] != nullid:
       
   413         raise util.Abort(_('outstanding uncommitted merge'))
   412     kwt = kwtools['templater']
   414     kwt = kwtools['templater']
   413     status = _status(ui, repo, kwt, *pats, **opts)
   415     status = _status(ui, repo, kwt, *pats, **opts)
   414     modified, added, removed, deleted, unknown, ignored, clean = status
   416     modified, added, removed, deleted, unknown, ignored, clean = status
   415     if modified or added or removed or deleted:
   417     if modified or added or removed or deleted:
   416         raise util.Abort(_('outstanding uncommitted changes in given files'))
   418         raise util.Abort(_('outstanding uncommitted changes'))
   417     wlock = lock = None
   419     wlock = lock = None
   418     try:
   420     try:
   419         wlock = repo.wlock()
   421         wlock = repo.wlock()
   420         lock = repo.lock()
   422         lock = repo.lock()
   421         kwt.overwrite(None, expand, clean)
   423         kwt.overwrite(None, expand, clean)
   687     def kw_diff(repo, node1=None, node2=None, files=None, match=_defmatch,
   689     def kw_diff(repo, node1=None, node2=None, files=None, match=_defmatch,
   688                  fp=None, changes=None, opts=None):
   690                  fp=None, changes=None, opts=None):
   689         # only expand if comparing against working dir
   691         # only expand if comparing against working dir
   690         if node2 is not None:
   692         if node2 is not None:
   691             kwt.matcher = util.never
   693             kwt.matcher = util.never
   692         elif node1 is not None and node1 != repo.changectx().node():
   694         elif node1 is not None and node1 != repo.dirstate.parents()[0]:
   693             kwt.restrict = True
   695             kwt.restrict = True
   694         try:
   696         try:
   695             patch_diff(repo, node1, node2, files, match, fp, changes, opts)
   697             patch_diff(repo, node1, node2, files, match, fp, changes, opts)
   696         except TypeError:
   698         except TypeError:
   697             patch_diff(repo, node1, node2, match, fp, changes, opts)
   699             patch_diff(repo, node1, node2, match, fp, changes, opts)