comparison mercurial/commands.py @ 1319:5a15df632e6a

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.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 22 Sep 2005 21:42:33 -0700
parents 3f4f76012bc9
children 5f277e73778f
comparison
equal deleted inserted replaced
1318:3f4f76012bc9 1319:5a15df632e6a
680 if opts['text']: 680 if opts['text']:
681 ui.warn("Warning: -t and --text is deprecated," 681 ui.warn("Warning: -t and --text is deprecated,"
682 " please use -m or --message instead.\n") 682 " please use -m or --message instead.\n")
683 message = opts['message'] or opts['text'] 683 message = opts['message'] or opts['text']
684 logfile = opts['logfile'] 684 logfile = opts['logfile']
685
686 if message and logfile:
687 raise util.Abort('options --message and --logfile are mutually '
688 'exclusive')
685 if not message and logfile: 689 if not message and logfile:
686 try: 690 try:
687 if logfile == '-': 691 if logfile == '-':
688 message = sys.stdin.read() 692 message = sys.stdin.read()
689 else: 693 else:
690 message = open(logfile).read() 694 message = open(logfile).read()
691 except IOError, why: 695 except IOError, inst:
692 ui.warn("Can't read commit message %s: %s\n" % (logfile, why)) 696 raise util.Abort("can't read commit message '%s': %s" %
697 (logfile, inst.strerror))
693 698
694 if opts['addremove']: 699 if opts['addremove']:
695 addremove(ui, repo, *pats, **opts) 700 addremove(ui, repo, *pats, **opts)
696 cwd = repo.getcwd() 701 cwd = repo.getcwd()
697 if not pats and cwd: 702 if not pats and cwd: