Apparently there were no tests for any of these errors.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Apparently there were no tests for any of these errors.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/logcmdutil.py (12 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz |
def getlimit(opts): | def getlimit(opts): | ||||
"""get the log limit according to option -l/--limit""" | """get the log limit according to option -l/--limit""" | ||||
limit = opts.get(b'limit') | limit = opts.get(b'limit') | ||||
if limit: | if limit: | ||||
try: | try: | ||||
limit = int(limit) | limit = int(limit) | ||||
except ValueError: | except ValueError: | ||||
raise error.Abort(_(b'limit must be a positive integer')) | raise error.InputError(_(b'limit must be a positive integer')) | ||||
if limit <= 0: | if limit <= 0: | ||||
raise error.Abort(_(b'limit must be positive')) | raise error.InputError(_(b'limit must be positive')) | ||||
else: | else: | ||||
limit = None | limit = None | ||||
return limit | return limit | ||||
def diff_parent(ctx): | def diff_parent(ctx): | ||||
"""get the context object to use as parent when diffing | """get the context object to use as parent when diffing | ||||
"""Parse --line-range log option and return a list of tuples (filename, | """Parse --line-range log option and return a list of tuples (filename, | ||||
(fromline, toline)). | (fromline, toline)). | ||||
""" | """ | ||||
linerangebyfname = [] | linerangebyfname = [] | ||||
for pat in opts.get(b'line_range', []): | for pat in opts.get(b'line_range', []): | ||||
try: | try: | ||||
pat, linerange = pat.rsplit(b',', 1) | pat, linerange = pat.rsplit(b',', 1) | ||||
except ValueError: | except ValueError: | ||||
raise error.Abort(_(b'malformatted line-range pattern %s') % pat) | raise error.InputError( | ||||
_(b'malformatted line-range pattern %s') % pat | |||||
) | |||||
try: | try: | ||||
fromline, toline = map(int, linerange.split(b':')) | fromline, toline = map(int, linerange.split(b':')) | ||||
except ValueError: | except ValueError: | ||||
raise error.Abort(_(b"invalid line range for %s") % pat) | raise error.InputError(_(b"invalid line range for %s") % pat) | ||||
msg = _(b"line range pattern '%s' must match exactly one file") % pat | msg = _(b"line range pattern '%s' must match exactly one file") % pat | ||||
fname = scmutil.parsefollowlinespattern(repo, None, pat, msg) | fname = scmutil.parsefollowlinespattern(repo, None, pat, msg) | ||||
linerangebyfname.append( | linerangebyfname.append( | ||||
(fname, util.processlinerange(fromline, toline)) | (fname, util.processlinerange(fromline, toline)) | ||||
) | ) | ||||
return linerangebyfname | return linerangebyfname | ||||
displayer.show(ctx, copies=copies) | displayer.show(ctx, copies=copies) | ||||
displayer.flush(ctx) | displayer.flush(ctx) | ||||
displayer.close() | displayer.close() | ||||
def checkunsupportedgraphflags(pats, opts): | def checkunsupportedgraphflags(pats, opts): | ||||
for op in [b"newest_first"]: | for op in [b"newest_first"]: | ||||
if op in opts and opts[op]: | if op in opts and opts[op]: | ||||
raise error.Abort( | raise error.InputError( | ||||
_(b"-G/--graph option is incompatible with --%s") | _(b"-G/--graph option is incompatible with --%s") | ||||
% op.replace(b"_", b"-") | % op.replace(b"_", b"-") | ||||
) | ) | ||||
def graphrevs(repo, nodes, opts): | def graphrevs(repo, nodes, opts): | ||||
limit = getlimit(opts) | limit = getlimit(opts) | ||||
nodes.reverse() | nodes.reverse() | ||||
if limit is not None: | if limit is not None: | ||||
nodes = nodes[:limit] | nodes = nodes[:limit] | ||||
return graphmod.nodes(repo, nodes) | return graphmod.nodes(repo, nodes) |