Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/logcmdutil.py (8 lines) | |||
M | tests/test-grep.t (20 lines) | |||
M | tests/test-log-linerange.t (2 lines) | |||
M | tests/test-log.t (18 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz |
for c in startctxs: | for c in startctxs: | ||||
if f in c: | if f in c: | ||||
found = True | found = True | ||||
elif c.hasdir(f): | elif c.hasdir(f): | ||||
# If a directory exists in any of the start revisions, | # If a directory exists in any of the start revisions, | ||||
# take the slow path. | # take the slow path. | ||||
found = slowpath = True | found = slowpath = True | ||||
if not found: | if not found: | ||||
raise error.Abort( | raise error.StateError( | ||||
_( | _( | ||||
b'cannot follow file not in any of the specified ' | b'cannot follow file not in any of the specified ' | ||||
b'revisions: "%s"' | b'revisions: "%s"' | ||||
) | ) | ||||
% f | % f | ||||
) | ) | ||||
elif wopts.follow: | elif wopts.follow: | ||||
for f in match.files(): | for f in match.files(): | ||||
if f not in wctx: | if f not in wctx: | ||||
# If the file exists, it may be a directory, so let it | # If the file exists, it may be a directory, so let it | ||||
# take the slow path. | # take the slow path. | ||||
if os.path.exists(repo.wjoin(f)): | if os.path.exists(repo.wjoin(f)): | ||||
slowpath = True | slowpath = True | ||||
continue | continue | ||||
else: | else: | ||||
raise error.Abort( | raise error.StateError( | ||||
_( | _( | ||||
b'cannot follow file not in parent ' | b'cannot follow file not in parent ' | ||||
b'revision: "%s"' | b'revision: "%s"' | ||||
) | ) | ||||
% f | % f | ||||
) | ) | ||||
filelog = repo.file(f) | filelog = repo.file(f) | ||||
if not filelog: | if not filelog: | ||||
# A file exists in wdir but not in history, which means | # A file exists in wdir but not in history, which means | ||||
# the file isn't committed yet. | # the file isn't committed yet. | ||||
raise error.Abort( | raise error.StateError( | ||||
_(b'cannot follow nonexistent file: "%s"') % f | _(b'cannot follow nonexistent file: "%s"') % f | ||||
) | ) | ||||
else: | else: | ||||
for f in match.files(): | for f in match.files(): | ||||
filelog = repo.file(f) | filelog = repo.file(f) | ||||
if not filelog: | if not filelog: | ||||
# A zero count may be a directory or deleted file, so | # A zero count may be a directory or deleted file, so | ||||
# try to find matching entries on the slow path. | # try to find matching entries on the slow path. | ||||
filter. | filter. | ||||
""" | """ | ||||
wctx = repo[None] | wctx = repo[None] | ||||
# Two-levels map of "rev -> file ctx -> [line range]". | # Two-levels map of "rev -> file ctx -> [line range]". | ||||
linerangesbyrev = {} | linerangesbyrev = {} | ||||
for fname, (fromline, toline) in _parselinerangeopt(repo, opts): | for fname, (fromline, toline) in _parselinerangeopt(repo, opts): | ||||
if fname not in wctx: | if fname not in wctx: | ||||
raise error.Abort( | raise error.StateError( | ||||
_(b'cannot follow file not in parent revision: "%s"') % fname | _(b'cannot follow file not in parent revision: "%s"') % fname | ||||
) | ) | ||||
fctx = wctx.filectx(fname) | fctx = wctx.filectx(fname) | ||||
for fctx, linerange in dagop.blockancestors(fctx, fromline, toline): | for fctx, linerange in dagop.blockancestors(fctx, fromline, toline): | ||||
rev = fctx.introrev() | rev = fctx.introrev() | ||||
if rev is None: | if rev is None: | ||||
rev = wdirrev | rev = wdirrev | ||||
if rev not in userrevs: | if rev not in userrevs: |
add0-cp1-mod1-cp3-mod3:3:data0 | add0-cp1-mod1-cp3-mod3:3:data0 | ||||
add0-cp1-mod1-cp3-mod3:3:data1 | add0-cp1-mod1-cp3-mod3:3:data1 | ||||
add0-cp1-mod1-cp3-mod3:3:data3 | add0-cp1-mod1-cp3-mod3:3:data3 | ||||
follow file history from wdir parent, copied in wdir: | follow file history from wdir parent, copied in wdir: | ||||
$ hg log -f add0-cp4 | $ hg log -f add0-cp4 | ||||
abort: cannot follow nonexistent file: "add0-cp4" | abort: cannot follow nonexistent file: "add0-cp4" | ||||
[255] | [20] | ||||
$ hg grep --diff -f data add0-cp4 | $ hg grep --diff -f data add0-cp4 | ||||
abort: cannot follow nonexistent file: "add0-cp4" | abort: cannot follow nonexistent file: "add0-cp4" | ||||
[255] | [20] | ||||
BROKEN: maybe better to abort | BROKEN: maybe better to abort | ||||
$ hg grep -f data add0-cp4 | $ hg grep -f data add0-cp4 | ||||
[1] | [1] | ||||
follow file history from wdir parent, removed: | follow file history from wdir parent, removed: | ||||
$ hg log -f add0-cp1-mod1-rm3 | $ hg log -f add0-cp1-mod1-rm3 | ||||
abort: cannot follow file not in parent revision: "add0-cp1-mod1-rm3" | abort: cannot follow file not in parent revision: "add0-cp1-mod1-rm3" | ||||
[255] | [20] | ||||
$ hg grep --diff -f data add0-cp1-mod1-rm3 | $ hg grep --diff -f data add0-cp1-mod1-rm3 | ||||
abort: cannot follow file not in parent revision: "add0-cp1-mod1-rm3" | abort: cannot follow file not in parent revision: "add0-cp1-mod1-rm3" | ||||
[255] | [20] | ||||
BROKEN: maybe better to abort | BROKEN: maybe better to abort | ||||
$ hg grep -f data add0-cp1-mod1-rm3 | $ hg grep -f data add0-cp1-mod1-rm3 | ||||
add0-cp1-mod1-rm3:1:data0 | add0-cp1-mod1-rm3:1:data0 | ||||
add0-cp1-mod1-rm3:1:data1 | add0-cp1-mod1-rm3:1:data1 | ||||
follow file history from wdir parent (explicit), removed: | follow file history from wdir parent (explicit), removed: | ||||
$ hg log -fr. add0-cp1-mod1-rm3 | $ hg log -fr. add0-cp1-mod1-rm3 | ||||
abort: cannot follow file not in any of the specified revisions: "add0-cp1-mod1-rm3" | abort: cannot follow file not in any of the specified revisions: "add0-cp1-mod1-rm3" | ||||
[255] | [20] | ||||
$ hg grep --diff -fr. data add0-cp1-mod1-rm3 | $ hg grep --diff -fr. data add0-cp1-mod1-rm3 | ||||
abort: cannot follow file not in any of the specified revisions: "add0-cp1-mod1-rm3" | abort: cannot follow file not in any of the specified revisions: "add0-cp1-mod1-rm3" | ||||
[255] | [20] | ||||
BROKEN: should abort | BROKEN: should abort | ||||
$ hg grep -fr. data add0-cp1-mod1-rm3 | $ hg grep -fr. data add0-cp1-mod1-rm3 | ||||
add0-cp1-mod1-rm3:1:data0 | add0-cp1-mod1-rm3:1:data0 | ||||
add0-cp1-mod1-rm3:1:data1 | add0-cp1-mod1-rm3:1:data1 | ||||
follow file history from wdir parent, removed in wdir: | follow file history from wdir parent, removed in wdir: | ||||
$ hg log -f add0-rm4 | $ hg log -f add0-rm4 | ||||
abort: cannot follow file not in parent revision: "add0-rm4" | abort: cannot follow file not in parent revision: "add0-rm4" | ||||
[255] | [20] | ||||
$ hg grep --diff -f data add0-rm4 | $ hg grep --diff -f data add0-rm4 | ||||
abort: cannot follow file not in parent revision: "add0-rm4" | abort: cannot follow file not in parent revision: "add0-rm4" | ||||
[255] | [20] | ||||
BROKEN: should abort | BROKEN: should abort | ||||
$ hg grep -f data add0-rm4 | $ hg grep -f data add0-rm4 | ||||
add0-rm4:3:data0 | add0-rm4:3:data0 | ||||
add0-rm4:1:data0 | add0-rm4:1:data0 | ||||
add0-rm4:0:data0 | add0-rm4:0:data0 | ||||
follow file history from wdir parent (explicit), removed in wdir: | follow file history from wdir parent (explicit), removed in wdir: | ||||
$ hg grep -fr2 data add0-cp2-mod2 | $ hg grep -fr2 data add0-cp2-mod2 | ||||
add0-cp2-mod2:2:data0 | add0-cp2-mod2:2:data0 | ||||
add0-cp2-mod2:2:data2 | add0-cp2-mod2:2:data2 | ||||
follow file history from specified revision, removed: | follow file history from specified revision, removed: | ||||
$ hg log -fr2 add0-rm2 | $ hg log -fr2 add0-rm2 | ||||
abort: cannot follow file not in any of the specified revisions: "add0-rm2" | abort: cannot follow file not in any of the specified revisions: "add0-rm2" | ||||
[255] | [20] | ||||
$ hg grep --diff -fr2 data add0-rm2 | $ hg grep --diff -fr2 data add0-rm2 | ||||
abort: cannot follow file not in any of the specified revisions: "add0-rm2" | abort: cannot follow file not in any of the specified revisions: "add0-rm2" | ||||
[255] | [20] | ||||
BROKEN: should abort | BROKEN: should abort | ||||
$ hg grep -fr2 data add0-rm2 | $ hg grep -fr2 data add0-rm2 | ||||
add0-rm2:0:data0 | add0-rm2:0:data0 | ||||
follow file history from specified revision, multiple files: | follow file history from specified revision, multiple files: | ||||
$ hg log -fr2 add0-cp2 add0-mod2 | $ hg log -fr2 add0-cp2 add0-mod2 |
[10] | [10] | ||||
We get an error for removed files. | We get an error for removed files. | ||||
$ hg rm dir/baz | $ hg rm dir/baz | ||||
$ hg ci -m 'remove baz' --quiet | $ hg ci -m 'remove baz' --quiet | ||||
$ hg log -f -L dir/baz,5:7 -p | $ hg log -f -L dir/baz,5:7 -p | ||||
abort: cannot follow file not in parent revision: "dir/baz" | abort: cannot follow file not in parent revision: "dir/baz" | ||||
[255] | [20] |
4:7e4639b4691b | 4:7e4639b4691b | ||||
$ hg log -ql1 "`pwd`" e | $ hg log -ql1 "`pwd`" e | ||||
4:7e4639b4691b | 4:7e4639b4691b | ||||
log -f empty path (or repo root) shouldn't crash | log -f empty path (or repo root) shouldn't crash | ||||
$ hg log -qfl1 '' inexistent | $ hg log -qfl1 '' inexistent | ||||
abort: cannot follow file not in parent revision: "inexistent" | abort: cannot follow file not in parent revision: "inexistent" | ||||
[255] | [20] | ||||
$ hg log -qfl1 . inexistent | $ hg log -qfl1 . inexistent | ||||
abort: cannot follow file not in parent revision: "inexistent" | abort: cannot follow file not in parent revision: "inexistent" | ||||
[255] | [20] | ||||
$ hg log -qfl1 "`pwd`" inexistent | $ hg log -qfl1 "`pwd`" inexistent | ||||
abort: cannot follow file not in parent revision: "inexistent" | abort: cannot follow file not in parent revision: "inexistent" | ||||
[255] | [20] | ||||
$ hg log -qfl1 '' e | $ hg log -qfl1 '' e | ||||
4:7e4639b4691b | 4:7e4639b4691b | ||||
$ hg log -qfl1 . e | $ hg log -qfl1 . e | ||||
4:7e4639b4691b | 4:7e4639b4691b | ||||
$ hg log -qfl1 "`pwd`" e | $ hg log -qfl1 "`pwd`" e | ||||
4:7e4639b4691b | 4:7e4639b4691b | ||||
-X, with explicit path | -X, with explicit path | ||||
$ hg log a -X a | $ hg log a -X a | ||||
-f, non-existent directory | -f, non-existent directory | ||||
$ hg log -f dir | $ hg log -f dir | ||||
abort: cannot follow file not in parent revision: "dir" | abort: cannot follow file not in parent revision: "dir" | ||||
[255] | [20] | ||||
-f, directory | -f, directory | ||||
$ hg up -q 3 | $ hg up -q 3 | ||||
$ hg log -f dir | $ hg log -f dir | ||||
changeset: 2:f8954cd4dc1f | changeset: 2:f8954cd4dc1f | ||||
user: test | user: test | ||||
date: Thu Jan 01 00:00:03 1970 +0000 | date: Thu Jan 01 00:00:03 1970 +0000 | ||||
2 (false !) | 2 (false !) | ||||
1 (false !) | 1 (false !) | ||||
0 (false !) | 0 (false !) | ||||
follow files from the specified revisions with missing patterns | follow files from the specified revisions with missing patterns | ||||
$ hg log -T '{rev}\n' -fr4 e x | $ hg log -T '{rev}\n' -fr4 e x | ||||
abort: cannot follow file not in any of the specified revisions: "x" | abort: cannot follow file not in any of the specified revisions: "x" | ||||
[255] | [20] | ||||
follow files from the specified revisions with directory patterns | follow files from the specified revisions with directory patterns | ||||
(BROKEN: should follow copies from dir/b@2) | (BROKEN: should follow copies from dir/b@2) | ||||
$ hg log -T '{rev}\n' -fr2 dir/b dir | $ hg log -T '{rev}\n' -fr2 dir/b dir | ||||
2 | 2 | ||||
1 (false !) | 1 (false !) | ||||
0 (false !) | 0 (false !) | ||||
== 0 == | == 0 == | ||||
d1/f1 | 1 + | d1/f1 | 1 + | ||||
1 files changed, 1 insertions(+), 0 deletions(-) | 1 files changed, 1 insertions(+), 0 deletions(-) | ||||
$ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat notfound | $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat notfound | ||||
abort: cannot follow file not in any of the specified revisions: "notfound" | abort: cannot follow file not in any of the specified revisions: "notfound" | ||||
[255] | [20] | ||||
follow files from wdir and non-wdir revision: | follow files from wdir and non-wdir revision: | ||||
$ hg log -T '{rev}\n' -fr'wdir()+.' f1-copy | $ hg log -T '{rev}\n' -fr'wdir()+.' f1-copy | ||||
f1-copy: no such file in rev 65624cd9070a | f1-copy: no such file in rev 65624cd9070a | ||||
2147483647 | 2147483647 | ||||
0 | 0 | ||||
follow added/removed files from wdir parent | follow added/removed files from wdir parent | ||||
$ hg log -T '{rev}\n' -f d1/f2 | $ hg log -T '{rev}\n' -f d1/f2 | ||||
abort: cannot follow nonexistent file: "d1/f2" | abort: cannot follow nonexistent file: "d1/f2" | ||||
[255] | [20] | ||||
$ hg log -T '{rev}\n' -f f1-copy | $ hg log -T '{rev}\n' -f f1-copy | ||||
abort: cannot follow nonexistent file: "f1-copy" | abort: cannot follow nonexistent file: "f1-copy" | ||||
[255] | [20] | ||||
$ hg log -T '{rev}\n' -f .d6/f1 | $ hg log -T '{rev}\n' -f .d6/f1 | ||||
abort: cannot follow file not in parent revision: ".d6/f1" | abort: cannot follow file not in parent revision: ".d6/f1" | ||||
[255] | [20] | ||||
$ hg revert -aqC | $ hg revert -aqC | ||||
Check that adding an arbitrary name shows up in log automatically | Check that adding an arbitrary name shows up in log automatically | ||||
$ cat > ../names.py <<EOF | $ cat > ../names.py <<EOF | ||||
> """A small extension to test adding arbitrary names to a repo""" | > """A small extension to test adding arbitrary names to a repo""" | ||||
> from __future__ import absolute_import | > from __future__ import absolute_import |