# HG changeset patch # User Yuya Nishihara # Date 1599804815 -32400 # Node ID 07324227f6b792d16c2146c3c62e6a2ab6cb25a2 # Parent a03fde1077ce566fa7c0cf943cc91028d7845d8f log: fix -fr'wdir()' PATH to follow newly added file Testing filelog doesn't make sense in this case because the file existence is tested against the specified changectxs. If the filelog is empty and if startctxs != [wctx], 'f not in c' should be triggered. diff -r a03fde1077ce -r 07324227f6b7 mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py Fri Sep 11 15:08:58 2020 +0900 +++ b/mercurial/logcmdutil.py Fri Sep 11 15:13:35 2020 +0900 @@ -698,12 +698,7 @@ # take the slow path. if any(f not in c for c in startctxs): slowpath = True - continue - filelog = repo.file(f) - if not filelog: - raise error.Abort( - _(b'cannot follow nonexistent file: "%s"') % f - ) + break elif follow: for f in match.files(): if f not in wctx: @@ -722,6 +717,8 @@ ) filelog = repo.file(f) if not filelog: + # A file exists in wdir but not in history, which means + # the file isn't committed yet. raise error.Abort( _(b'cannot follow nonexistent file: "%s"') % f ) diff -r a03fde1077ce -r 07324227f6b7 tests/test-log.t --- a/tests/test-log.t Fri Sep 11 15:08:58 2020 +0900 +++ b/tests/test-log.t Fri Sep 11 15:13:35 2020 +0900 @@ -2295,15 +2295,21 @@ 1 files changed, 1 insertions(+), 0 deletions(-) - BROKEN: added file should exist in wdir $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat d1/f2 - abort: cannot follow nonexistent file: "d1/f2" - [255] + == 2147483647 == + d1/f2 | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + - BROKEN: copied file should exist in wdir $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat f1-copy - abort: cannot follow nonexistent file: "f1-copy" - [255] + == 2147483647 == + f1-copy | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + + == 0 == + d1/f1 | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat notfound notfound: $ENOENT$