Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 6190:a79d9408806f
Move finding/checking the log limit to cmdutil
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 29 Feb 2008 01:51:23 +0100 |
parents | 154f8be6272b |
children | f89fd07fc51d |
comparison
equal
deleted
inserted
replaced
6189:81cbb5dfdec0 | 6190:a79d9408806f |
---|---|
86 message = open(logfile).read() | 86 message = open(logfile).read() |
87 except IOError, inst: | 87 except IOError, inst: |
88 raise util.Abort(_("can't read commit message '%s': %s") % | 88 raise util.Abort(_("can't read commit message '%s': %s") % |
89 (logfile, inst.strerror)) | 89 (logfile, inst.strerror)) |
90 return message | 90 return message |
91 | |
92 def loglimit(opts): | |
93 """get the log limit according to option -l/--limit""" | |
94 limit = opts.get('limit') | |
95 if limit: | |
96 try: | |
97 limit = int(limit) | |
98 except ValueError: | |
99 raise util.Abort(_('limit must be a positive integer')) | |
100 if limit <= 0: raise util.Abort(_('limit must be positive')) | |
101 else: | |
102 limit = sys.maxint | |
103 return limit | |
91 | 104 |
92 def setremoteconfig(ui, opts): | 105 def setremoteconfig(ui, opts): |
93 "copy remote options to ui tree" | 106 "copy remote options to ui tree" |
94 if opts.get('ssh'): | 107 if opts.get('ssh'): |
95 ui.setconfig("ui", "ssh", opts['ssh']) | 108 ui.setconfig("ui", "ssh", opts['ssh']) |