mercurialtortoisehg

Convert repository to older version (without sparse revlog)


Our team is using Mercurial for version control, with the central repository located on a shared network drive (i.e. we are not using a server). Our company restricts what we can install on our computers, and everyone had Hg version 4.6. One of the team members used admin rights he has to install the latest TortoiseHg (4.9). It seemingly resulted in the central repository to be converted to the newest version. Now another team member, with the old Mercurial, cannot pull from the central repository. It says

repository requires features unknown to this Mercurial: sparserevlog

I read a bit about it, and it seems that this feature is not critical for us. Would it be possible to revert the central repository to the version without sparse revlog?


Solution

  • With 4.9, new repositories will be created using sparse-revlog by default. However existing repositories are untouched. They stay in the same format they have been created with.

    Avoiding the issue at repository creation

    To prevent the users who upgraded to create sparse-revlog repositories he needs to set the following in his user configuration (hg config -e)

    [format]
    sparse-revlog = no
    

    Do you have global control of your users configuration?

    Downgrading existing repositories

    If you want to downgrade such newly created repository you do the following:

    1. add the following to the repository configuration (hg config -l)
    [format]
    sparse-revlog = no
    
    1. run hg debugupgraderepo --run (with 4.7 or newer)

    Upgrading existing repositories

    If you want to upgrade existing created repository, the process is similar:

    1. add the following to the repository configuration (hg config -l)
    [format]
    sparse-revlog = yes
    
    1. run hg debugupgraderepo --run (with 4.7 or newer)

    Note: the page https://www.selenic.com/mercurial/hgrc.5.html#format is outdated. The website for mercurial have been https://www.mercurial-scm.org/ for a couple of years.