[PATCH 6 of 7] journal: ensure that dirstate is instantiated via own wrapdirstate()
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Sun Jul 2 17:53:20 UTC 2017
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1499017960 -32400
# Mon Jul 03 02:52:40 2017 +0900
# Node ID 0dcbaa178353e32b23e13bc8655a6a90978b639d
# Parent 9fd405b51136176f2498561bbd0a0c485a1f2eac
journal: ensure that dirstate is instantiated via own wrapdirstate()
If dirstate is instantiated before reposetup() of journal extension,
it doesn't have "journalstorage" property, even if it is instantiated
by wrapdirstate() wrapping repo.dirstate, because wrapdirstate() works
as normal repo.dirstate before marking repo as journal-ed in
reposetup().
To ensure that dirstate is instantiated via own wrapdirstate(), this
patch completely discards already instantiated dirstate, like as
previous patch for fsmonitor.
diff --git a/hgext/journal.py b/hgext/journal.py
--- a/hgext/journal.py
+++ b/hgext/journal.py
@@ -70,6 +70,18 @@ def reposetup(ui, repo):
if repo.local():
repo.journal = journalstorage(repo)
+ # Completely discard dirstate, in order to ensure that
+ # dirstate is instantiated via wrapdirstate() after this
+ # reposetup(). Otherwise, recorddirstateparents() omits
+ # recording, because repo.dirstate already instantiated at
+ # this point doesn't have "journalstorage" property.
+ if 'dirstate' in repo._filecache:
+ del repo._filecache['dirstate']
+ try:
+ delattr(repo.unfiltered(), 'dirstate')
+ except AttributeError:
+ pass
+
def runcommand(orig, lui, repo, cmd, fullargs, *args):
"""Track the command line options for recording in the journal"""
journalstorage.recordcommand(*fullargs)
More information about the Mercurial-devel
mailing list