Mercurial > public > mercurial-scm > hg-stable
diff mercurial/statichttprepo.py @ 52739:0f2268783c11
clone: explicitly steal lock instead of assigning previous lock
The issue with reusing the lock from another repository is that various internal
state are no longer correct, the main example of that is the dirstate, captured
in the wlock to make sure it is written (when needed) on lock release. So
instead, we create a proper lock from the repository, but "stealing" the on-disk
lock from the previous object.
This is a bit weird, but less than the previous situation.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 30 Jan 2025 09:23:16 +0100 |
parents | 5cc8deb96b48 |
children |
line wrap: on
line diff
--- a/mercurial/statichttprepo.py Fri Dec 20 16:11:19 2024 +0100 +++ b/mercurial/statichttprepo.py Thu Jan 30 09:23:16 2025 +0100 @@ -253,7 +253,7 @@ def peer(self, path=None, remotehidden=False): return statichttppeer(self, path=path, remotehidden=remotehidden) - def wlock(self, wait=True): + def wlock(self, wait=True, steal_from=None): raise error.LockUnavailable( 0, pycompat.sysstr(_(b'lock not available')), @@ -261,7 +261,7 @@ _(b'cannot lock static-http repository'), ) - def lock(self, wait=True): + def lock(self, wait=True, steal_from=None): raise error.LockUnavailable( 0, pycompat.sysstr(_(b'lock not available')),