# HG changeset patch # User Denis Laxalde # Date 2017-10-19 12:12:49 # Node ID 2e45bbd3db7bab742cddcf15798759b65177df5f # Parent 5c7dbb73017996a25ca8b1c7d3391cef6b845c71 log: disable bare file patterns with --line-range Currently, specifying both a line-range pattern and a bare file pattern results in an AND operation whereas we probably want an OR so that bare file patterns are like a line-range pattern with all lines specified. So, until this works as expected, we disable this. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3383,6 +3383,11 @@ def log(ui, repo, *pats, **opts): if linerange and not opts.get('follow'): raise error.Abort(_('--line-range requires --follow')) + if linerange and pats: + raise error.Abort( + _('FILE arguments are not compatible with --line-range option') + ) + if opts.get('follow') and opts.get('rev'): opts['rev'] = [revsetlang.formatspec('reverse(::%lr)', opts.get('rev'))] del opts['follow'] diff --git a/tests/test-log-linerange.t b/tests/test-log-linerange.t --- a/tests/test-log-linerange.t +++ b/tests/test-log-linerange.t @@ -288,64 +288,11 @@ With some white-space diff option, respe +4 -Regular file patterns are allowed with -L and their diff shows all lines. +Regular file patterns are not allowed. $ hg log -f -L foo,5:7 -p bar - changeset: 5:cfdf972b3971 - tag: tip - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+ - - diff --git a/bar b/bar - --- a/bar - +++ b/bar - @@ -1,4 +1,4 @@ - -a - +a+ - b - c - d - diff --git a/foo b/foo - --- a/foo - +++ b/foo - @@ -4,7 +4,7 @@ - 0 - 1 - 2+ - -3 - +3+ - 4 - 5 - 6 - - changeset: 2:63a884426fd0 - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: 2 -> 2+; added bar - - diff --git a/bar b/bar - new file mode 100644 - --- /dev/null - +++ b/bar - @@ -0,0 +1,5 @@ - +a - +b - +c - +d - +e - diff --git a/foo b/foo - --- a/foo - +++ b/foo - @@ -3,6 +3,6 @@ - 0 - 0 - 1 - -2 - +2+ - 3 - 4 - + abort: FILE arguments are not compatible with --line-range option + [255] Option --rev acts as a restriction.