diff -r 6afd8a87a657 -r 59e69ed81776 mercurial/localrepo.py --- a/mercurial/localrepo.py Tue Feb 21 01:21:00 2017 +0900 +++ b/mercurial/localrepo.py Tue Feb 21 01:21:00 2017 +0900 @@ -56,6 +56,7 @@ subrepo, tags as tagsmod, transaction, + txnutil, util, ) @@ -513,10 +514,8 @@ @storecache('00changelog.i') def changelog(self): c = changelog.changelog(self.svfs) - if 'HG_PENDING' in encoding.environ: - p = encoding.environ['HG_PENDING'] - if p.startswith(self.root): - c.readpending('00changelog.i.a') + if txnutil.mayhavepending(self.root): + c.readpending('00changelog.i.a') return c def _constructmanifest(self):