From patchwork Mon Jan 13 19:44:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: init: changed creation order of 00changelog and requires files (issue3960) From: Lucas Moscovicz X-Patchwork-Id: 3320 Message-Id: To: mercurial-devel@selenic.com Date: Mon, 13 Jan 2014 11:44:52 -0800 # HG changeset patch # User Lucas Moscovicz # 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 = {}