changeset 6672:6004eedb13f4

keyword: mimic cmdutil.bail_if_changed even more At the check before overwriting with kwexpand, kwshrink: - abort when in middle of merge - give terser abort message
author Christian Ebert <blacktrash@gmx.net>
date Thu, 12 Jun 2008 02:27:06 +0200
parents 938eddd76237
children 16d2d093d1dd
files hgext/keyword.py tests/test-keyword.out
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/keyword.py	Fri Jun 13 17:29:10 2008 -0500
+++ b/hgext/keyword.py	Thu Jun 12 02:27:06 2008 +0200
@@ -263,11 +263,13 @@
 
 def _kwfwrite(ui, repo, expand, *pats, **opts):
     '''Selects files and passes them to kwtemplater.overwrite.'''
+    if repo.dirstate.parents()[1] != nullid:
+        raise util.Abort(_('outstanding uncommitted merge'))
     kwt = kwtools['templater']
     status = _status(ui, repo, kwt, *pats, **opts)
     modified, added, removed, deleted, unknown, ignored, clean = status
     if modified or added or removed or deleted:
-        raise util.Abort(_('outstanding uncommitted changes in given files'))
+        raise util.Abort(_('outstanding uncommitted changes'))
     wlock = lock = None
     try:
         wlock = repo.wlock()
--- a/tests/test-keyword.out	Fri Jun 13 17:29:10 2008 -0500
+++ b/tests/test-keyword.out	Thu Jun 12 02:27:06 2008 +0200
@@ -350,7 +350,7 @@
 % kwexpand a
 overwriting a expanding keywords
 % kwexpand x/a should abort
-abort: outstanding uncommitted changes in given files
+abort: outstanding uncommitted changes
 x/a
  x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
 overwriting x/a expanding keywords