Mercurial > hg
comparison mercurial/cmdutil.py @ 14635:217b7d83afc3
cmdutil, logmessage: use ui.fin when reading from '-'
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Wed, 08 Jun 2011 14:54:52 +0300 |
parents | a67e866f46f9 |
children | 5e9d691229d5 |
comparison
equal
deleted
inserted
replaced
14634:1679d73c9464 | 14635:217b7d83afc3 |
---|---|
74 raise util.Abort(_('outstanding uncommitted merge')) | 74 raise util.Abort(_('outstanding uncommitted merge')) |
75 modified, added, removed, deleted = repo.status()[:4] | 75 modified, added, removed, deleted = repo.status()[:4] |
76 if modified or added or removed or deleted: | 76 if modified or added or removed or deleted: |
77 raise util.Abort(_("outstanding uncommitted changes")) | 77 raise util.Abort(_("outstanding uncommitted changes")) |
78 | 78 |
79 def logmessage(opts): | 79 def logmessage(ui, opts): |
80 """ get the log message according to -m and -l option """ | 80 """ get the log message according to -m and -l option """ |
81 message = opts.get('message') | 81 message = opts.get('message') |
82 logfile = opts.get('logfile') | 82 logfile = opts.get('logfile') |
83 | 83 |
84 if message and logfile: | 84 if message and logfile: |
85 raise util.Abort(_('options --message and --logfile are mutually ' | 85 raise util.Abort(_('options --message and --logfile are mutually ' |
86 'exclusive')) | 86 'exclusive')) |
87 if not message and logfile: | 87 if not message and logfile: |
88 try: | 88 try: |
89 if logfile == '-': | 89 if logfile == '-': |
90 message = sys.stdin.read() | 90 message = ui.fin.read() |
91 else: | 91 else: |
92 message = '\n'.join(util.readfile(logfile).splitlines()) | 92 message = '\n'.join(util.readfile(logfile).splitlines()) |
93 except IOError, inst: | 93 except IOError, inst: |
94 raise util.Abort(_("can't read commit message '%s': %s") % | 94 raise util.Abort(_("can't read commit message '%s': %s") % |
95 (logfile, inst.strerror)) | 95 (logfile, inst.strerror)) |
1161 def commit(ui, repo, commitfunc, pats, opts): | 1161 def commit(ui, repo, commitfunc, pats, opts): |
1162 '''commit the specified files or all outstanding changes''' | 1162 '''commit the specified files or all outstanding changes''' |
1163 date = opts.get('date') | 1163 date = opts.get('date') |
1164 if date: | 1164 if date: |
1165 opts['date'] = util.parsedate(date) | 1165 opts['date'] = util.parsedate(date) |
1166 message = logmessage(opts) | 1166 message = logmessage(ui, opts) |
1167 | 1167 |
1168 # extract addremove carefully -- this function can be called from a command | 1168 # extract addremove carefully -- this function can be called from a command |
1169 # that doesn't support addremove | 1169 # that doesn't support addremove |
1170 if opts.get('addremove'): | 1170 if opts.get('addremove'): |
1171 scmutil.addremove(repo, pats, opts) | 1171 scmutil.addremove(repo, pats, opts) |