[PATCH 6 of 8 RFC] annotate: abort early if no file is specified
Yuya Nishihara
yuya at tcha.org
Tue Aug 19 17:56:20 CDT 2014
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1408179566 -32400
# Sat Aug 16 17:59:26 2014 +0900
# Node ID 5b82336b237f8f45a01f31d4d0788464a1198843
# Parent 5358071e65be2fd330b45d5989198101ae6b01d6
annotate: abort early if no file is specified
This change is intended to move getdate function near opmap table.
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -260,6 +260,9 @@ def annotate(ui, repo, *pats, **opts):
Returns 0 on success.
"""
+ if not pats:
+ raise util.Abort(_('at least one filename or pattern is required'))
+
if opts.get('follow'):
# --follow is deprecated and now just an alias for -f/--file
# to mimic the behavior of Mercurial before version 1.5
@@ -267,10 +270,6 @@ def annotate(ui, repo, *pats, **opts):
datefunc = ui.quiet and util.shortdate or util.datestr
getdate = util.cachefunc(lambda x: datefunc(x[0].date()))
-
- if not pats:
- raise util.Abort(_('at least one filename or pattern is required'))
-
hexfn = ui.debugflag and hex or short
opmap = [('user', ' ', lambda x: ui.shortuser(x[0].user())),
More information about the Mercurial-devel
mailing list