comparison mercurial/localrepo.py @ 31054:59e69ed81776

localrepo: check HG_PENDING strictly Before this patch, checking HG_PENDING for changelog in localrepo.py might cause unintentional reading unrelated '00changelog.i.a' in, because HG_PENDING is checked by str.startswith(). An external hook spawned by inner repository in nested ones satisfies this condition. This patch uses txnutil.mayhavepending() to check HG_PENDING strictly. BTW, this patch may cause failure of bisect in the repository of Mercurial itself, if examination at bisecting assumes that an external hook can see all pending changes while nested transactions across repositories. This invisibility issue will be fixed by subsequent patch, which allows HG_PENDING to refer multiple repositories.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 21 Feb 2017 01:21:00 +0900
parents 6cf2857526c7
children 95ec3ad62f62
comparison
equal deleted inserted replaced
31053:6afd8a87a657 31054:59e69ed81776
54 scmutil, 54 scmutil,
55 store, 55 store,
56 subrepo, 56 subrepo,
57 tags as tagsmod, 57 tags as tagsmod,
58 transaction, 58 transaction,
59 txnutil,
59 util, 60 util,
60 ) 61 )
61 62
62 release = lockmod.release 63 release = lockmod.release
63 urlerr = util.urlerr 64 urlerr = util.urlerr
511 return store 512 return store
512 513
513 @storecache('00changelog.i') 514 @storecache('00changelog.i')
514 def changelog(self): 515 def changelog(self):
515 c = changelog.changelog(self.svfs) 516 c = changelog.changelog(self.svfs)
516 if 'HG_PENDING' in encoding.environ: 517 if txnutil.mayhavepending(self.root):
517 p = encoding.environ['HG_PENDING'] 518 c.readpending('00changelog.i.a')
518 if p.startswith(self.root):
519 c.readpending('00changelog.i.a')
520 return c 519 return c
521 520
522 def _constructmanifest(self): 521 def _constructmanifest(self):
523 # This is a temporary function while we migrate from manifest to 522 # This is a temporary function while we migrate from manifest to
524 # manifestlog. It allows bundlerepo and unionrepo to intercept the 523 # manifestlog. It allows bundlerepo and unionrepo to intercept the