# HG changeset patch # User Christian Ebert # Date 1212764936 -7200 # Node ID 5e2be38cb3dd274f4018d85450fd625e1a1ce7bc # Parent 47bbe7c2fa7d9770971b94aff12e8c3da4ba54a7 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 diff -r 47bbe7c2fa7d -r 5e2be38cb3dd hgkw/keyword.py --- a/hgkw/keyword.py Sun Jun 01 13:35:12 2008 +0200 +++ b/hgkw/keyword.py Fri Jun 06 17:08:56 2008 +0200 @@ -265,11 +265,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() diff -r 47bbe7c2fa7d -r 5e2be38cb3dd tests/test-keyword.out --- a/tests/test-keyword.out Sun Jun 01 13:35:12 2008 +0200 +++ b/tests/test-keyword.out Fri Jun 06 17:08:56 2008 +0200 @@ -345,7 +345,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