# HG changeset patch # User Yuya Nishihara # Date 1543052324 -32400 # Node ID e7d6a9082bdfe285d7d2f4b77c43bd8a0346db19 # Parent 7c25d2233d531bf6b76866fe312767bed6af27c5 annotate: check and update command options first It helps extracting helper class. diff -r 7c25d2233d53 -r e7d6a9082bdf mercurial/commands.py --- a/mercurial/commands.py Sat Nov 24 18:36:44 2018 +0900 +++ b/mercurial/commands.py Sat Nov 24 18:38:44 2018 +0900 @@ -320,6 +320,14 @@ # to mimic the behavior of Mercurial before version 1.5 opts['file'] = True + if (not opts.get('user') and not opts.get('changeset') + and not opts.get('date') and not opts.get('file')): + opts['number'] = True + + linenumber = opts.get('line_number') is not None + if linenumber and (not opts.get('changeset')) and (not opts.get('number')): + raise error.Abort(_('at least one of -n/-c is required for -l')) + rev = opts.get('rev') if rev: repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn') @@ -373,14 +381,6 @@ 'lineno': 'line_number', } - if (not opts.get('user') and not opts.get('changeset') - and not opts.get('date') and not opts.get('file')): - opts['number'] = True - - linenumber = opts.get('line_number') is not None - if linenumber and (not opts.get('changeset')) and (not opts.get('number')): - raise error.Abort(_('at least one of -n/-c is required for -l')) - ui.pager('annotate') if rootfm.isplain():