[PATCH] init: changed creation order of 00changelog and requires files (issue3960)

Lucas Moscovicz lmoscovicz at fb.com
Mon Jan 13 13:44:52 CST 2014


# HG changeset patch
# User Lucas Moscovicz <lmoscovicz at fb.com>
# Date 1389639192 28800
#      Mon Jan 13 10:53:12 2014 -0800
# Node ID d648d25ecc9de3424cf843903a541e97800db37f
# Parent  f694cd81b600b65d23dcdc7a02cfd6a57dd1d018
init: changed creation order of 00changelog and requires files (issue3960)

When initializing a repo with hg init if another client cloned the repo after
the 00changelog file was created but before the requires file was created they
would get an error about unknown revlog format.  To fix it, I changed the
creation order of those files since the changelog file can be created at any
time during the initialization.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -206,12 +206,6 @@
                         requirements.append("fncache")
                         if self.ui.configbool('format', 'dotencode', True):
                             requirements.append('dotencode')
-                    # create an invalid changelog
-                    self.vfs.append(
-                        "00changelog.i",
-                        '\0\0\0\2' # represents revlogv2
-                        ' dummy changelog to prevent using the old repo layout'
-                    )
                 if self.ui.configbool('format', 'generaldelta', False):
                     requirements.append("generaldelta")
                 requirements = set(requirements)
@@ -249,7 +243,13 @@
         self._applyrequirements(requirements)
         if create:
             self._writerequirements()
-
+            if self.ui.configbool('format', 'usestore', True):
+                # create an invalid changelog
+                self.vfs.append(
+                    "00changelog.i",
+                    '\0\0\0\2' # represents revlogv2
+                    ' dummy changelog to prevent using the old repo layout'
+                )
 
         self._branchcaches = {}
         self.filterpats = {}


More information about the Mercurial-devel mailing list