changeset 40715:e7d6a9082bdf

annotate: check and update command options first It helps extracting helper class.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 24 Nov 2018 18:38:44 +0900
parents 7c25d2233d53
children d4c550c703d7
files mercurial/commands.py
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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():