# HG changeset patch # User Klaus Koch # Date 2011-03-13 14:04:13 # Node ID 29c800ee54cf573683ff4b2551e9513b5815cd8e # Parent 71a96f6c205dcbfbe6a770d11133cc9447f3351b graphlog: give meaningful error if more than one file is given diff --git a/hgext/graphlog.py b/hgext/graphlog.py --- a/hgext/graphlog.py +++ b/hgext/graphlog.py @@ -319,7 +319,11 @@ def _wrapcmd(ui, cmd, table, wrapfn): '''wrap the command''' def graph(orig, *args, **kwargs): if kwargs['graph']: - return wrapfn(*args, **kwargs) + try: + return wrapfn(*args, **kwargs) + except TypeError, e: + if len(args) > wrapfn.func_code.co_argcount: + raise util.Abort(_('--graph option allows at most one file')) return orig(*args, **kwargs) entry = extensions.wrapcommand(table, cmd, graph) entry[1].append(('G', 'graph', None, _("show the revision DAG"))) diff --git a/tests/test-glog.t b/tests/test-glog.t --- a/tests/test-glog.t +++ b/tests/test-glog.t @@ -686,6 +686,11 @@ Unused arguments: show revision history alongside an ASCII revision graph [255] +Only one file is allowed: + $ hg log -G foo bar + abort: --graph option allows at most one file + [255] + Empty revision range - display nothing: $ hg glog -r 1..0