Fix behaviour of commit.
authorBryan O'Sullivan <bos@serpentine.com>
Thu, 22 Sep 2005 21:42:33 -0700
changeset 1319 5a15df632e6a
parent 1318 3f4f76012bc9
child 1320 5f277e73778f
Fix behaviour of commit. It's now a fatal error if the option to --logfile isn't readable. Ditto if both --message and --logfile are specified.
mercurial/commands.py
--- a/mercurial/commands.py	Thu Sep 22 21:29:02 2005 -0700
+++ b/mercurial/commands.py	Thu Sep 22 21:42:33 2005 -0700
@@ -682,14 +682,19 @@
                 " please use -m or --message instead.\n")
     message = opts['message'] or opts['text']
     logfile = opts['logfile']
+
+    if message and logfile:
+        raise util.Abort('options --message and --logfile are mutually '
+                         'exclusive')
     if not message and logfile:
         try:
             if logfile == '-':
                 message = sys.stdin.read()
             else:
                 message = open(logfile).read()
-        except IOError, why:
-            ui.warn("Can't read commit message %s: %s\n" % (logfile, why))
+        except IOError, inst:
+            raise util.Abort("can't read commit message '%s': %s" %
+                             (logfile, inst.strerror))
 
     if opts['addremove']:
         addremove(ui, repo, *pats, **opts)