Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 26748:5ba0a99ff27f
dirstate: make dirstate.write() callers pass transaction object to it
Now, 'dirstate.write(tr)' delays writing in-memory changes out, if a
transaction is running.
This may cause treating this revision as "the first bad one" at
bisecting in some cases using external hook process inside transaction
scope, because some external hooks and editor process are still
invoked without HG_PENDING and pending changes aren't visible to them.
'dirstate.write()' callers below in localrepo.py explicitly use 'None'
as 'tr', because they can assume that no transaction is running:
- just before starting transaction
- at closing transaction, or
- at unlocking wlock
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sat, 17 Oct 2015 01:15:34 +0900 |
parents | e1568d5eb052 |
children | 520defbc0335 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sat Oct 17 01:15:34 2015 +0900 +++ b/mercurial/localrepo.py Sat Oct 17 01:15:34 2015 +0900 @@ -977,7 +977,7 @@ hint=_("run 'hg recover' to clean up transaction")) # make journal.dirstate contain in-memory changes at this point - self.dirstate.write() + self.dirstate.write(None) idbase = "%.40f#%f" % (random.random(), time.time()) txnid = 'TXN:' + util.sha1(idbase).hexdigest() @@ -1005,7 +1005,7 @@ # transaction, if tr.addfilegenerator (via # dirstate.write or so) isn't invoked while # transaction running - repo.dirstate.write() + repo.dirstate.write(None) else: # prevent in-memory changes from being written out at # the end of outer wlock scope or so @@ -1319,7 +1319,7 @@ if self.dirstate.pendingparentchange(): self.dirstate.invalidate() else: - self.dirstate.write() + self.dirstate.write(None) self._filecache['dirstate'].refresh()