[PATCH 8 of 8 upgraderepo V3] repair: clean up stale lock file from store backup

Augie Fackler raf at durin42.com
Sat Dec 24 15:23:30 EST 2016


On Sun, Dec 18, 2016 at 05:08:04PM -0800, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1480041929 28800
> #      Thu Nov 24 18:45:29 2016 -0800
> # Node ID 1efcda54217b590bd076bffaaf18a98fe9096dc7
> # Parent  96b6f747358116643b039d9c91157cde27106662
> repair: clean up stale lock file from store backup

This series LGTM. It's got a few big commits in it, but they're all
configurational code that is pretty easy to read over and doesn't
merit further splitting of the series or asking for more roundtrips.

>
> Since we did a directory rename on the stores, the source
> repository's lock path now references the dest repository's
> lock path and the dest repository's lock path now references
> a non-existent filename.
>
> So releasing the lock on the source will unlock the dest and
> releasing the lock on the dest will no-op because it fails due
> to file not found. So we clean up the dest's lock manually.
>
> diff --git a/mercurial/repair.py b/mercurial/repair.py
> --- a/mercurial/repair.py
> +++ b/mercurial/repair.py
> @@ -920,6 +920,12 @@ def _upgraderepo(ui, srcrepo, dstrepo, r
>                 'again\n'))
>      scmutil.writerequires(srcrepo.vfs, requirements)
>
> +    # The lock file from the old store won't be removed because nothing has a
> +    # reference to its new location. So clean it up manually. Alternatively, we
> +    # could update srcrepo.svfs and other variables to point to the new
> +    # location. This is simpler.
> +    backupvfs.unlink('store/lock')
> +
>      return backuppath
>
>  def upgraderepo(ui, repo, run=False, optimize=None):
> diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
> --- a/tests/test-upgrade-repo.t
> +++ b/tests/test-upgrade-repo.t
> @@ -303,7 +303,6 @@ old store should be backed up
>    00manifest.i
>    data
>    fncache
> -  lock
>    phaseroots
>    undo
>    undo.backup.fncache
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list