annotate: check and update command options first
It helps extracting helper class.
--- 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():