# HG changeset patch # User Yuya Nishihara # Date 1428207406 -32400 # Node ID c560d8c687916cb70a6d54c2c9ddcb5c9e457be2 # Parent 11e8fec00234922bec35808f45c58d444b5da441 cat: disable optimization of single file case for workingctx It crashes because workingctx has no manifest. diff -r 11e8fec00234 -r c560d8c68791 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Thu Apr 09 22:18:55 2015 +0900 +++ b/mercurial/cmdutil.py Sun Apr 05 13:16:46 2015 +0900 @@ -2403,7 +2403,7 @@ file = matcher.files()[0] mf = repo.manifest mfnode = ctx.manifestnode() - if mf.find(mfnode, file)[0]: + if mfnode and mf.find(mfnode, file)[0]: write(file) return 0 diff -r 11e8fec00234 -r c560d8c68791 tests/test-cat.t --- a/tests/test-cat.t Thu Apr 09 22:18:55 2015 +0900 +++ b/tests/test-cat.t Sun Apr 05 13:16:46 2015 +0900 @@ -63,3 +63,8 @@ tmp/h_45116003780e tmp/r_2 +Test working directory + + $ echo b-wdir > b + $ hg cat -r 'wdir()' b + b-wdir