# HG changeset patch
# User FUJIWARA Katsunori <fo...@lares.dti.ne.jp>
# Date 1476456913 -32400
#      Fri Oct 14 23:55:13 2016 +0900
# Node ID 681b0442741642fb0a8300b2be72150422c0ea83
# Parent  72486917916f6d47525f721cd5b27012091122ed
# Available At https://fo...@bitbucket.org/foozy/hg-experimental
#              hg pull https://fo...@bitbucket.org/foozy/hg-experimental -r 
sqldirstate: write fake dirstate always to detect changes correctly

Before this patch, if sqldirstate.fakedirstate configuration is false
value, (fake) dirstate isn't written out (or explicitly unlinked),

In such case, @filecache never detects change of dirstate by another
process/thread, because not-existing file never change its file stat.

To achieve checking cache validity without existence of .hg/dirstate
file, we should use another cache annotation instead of @filecache.

This patch removes code paths to avoid writing (or unlinking) fake
dirstate, and writes fake dirstate always to detect changes correctly.

Just removing these code paths seems reasonable enough, because it was
already confirmed at Mercurial 4.0 sprint that there is no concrete
usecase for sqldirstate.fakedirstate configuration.

diff --git a/sqldirstate/__init__.py b/sqldirstate/__init__.py
--- a/sqldirstate/__init__.py
+++ b/sqldirstate/__init__.py
@@ -67,10 +67,7 @@ def upgrade(ui, repo):
-        if ui.configbool('sqldirstate', 'fakedirstate', True):
-            writefakedirstate(repo.dirstate)
-        else:
-            repo.dirstate._opener.unlink('dirstate')
+        writefakedirstate(repo.dirstate)
         del repo.dirstate
diff --git a/sqldirstate/sqldirstate.py b/sqldirstate/sqldirstate.py
--- a/sqldirstate/sqldirstate.py
+++ b/sqldirstate/sqldirstate.py
@@ -485,8 +485,7 @@ def makedirstate(cls):
             if '_nonnormalset' in self.__dict__:
                 delattr(self, '_nonnormalset')
-            if self._ui.configbool('sqldirstate', 'fakedirstate', True):
-                writefakedirstate(self)
+            writefakedirstate(self)
         def _backupandwrite(self, tr):
             if not self.skipbackups:
Mercurial-devel mailing list

Reply via email to