largefiles: put whole "hgupdaterepo" process into the same "wlock" scope
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Fri, 15 Aug 2014 20:28:51 +0900
changeset 22193 efc591e8b35c
parent 22192 d1823cdf8554
child 22194 216942807308
largefiles: put whole "hgupdaterepo" process into the same "wlock" scope Before this patch, there are two distinct "wlock" scopes below in "hgupdaterepo": 1. "merge.update" via original "hg.updaterepo" function 2. "updatelfiles" specific "wlock" scope (to synchronize largefile dirstate) In addition to them, "dirstate.walk" is executed between these "wlock" scopes. But these should be executed in the same "wlock" scope for consistency, because many (indirect) users of "hg.updaterepo" don't get "wlock" explicitly before invocation of it. "hg.clean" is invoked without "wlock" from: - mqrepo.restore in mq - bisect in commands - update in commands "hg.update" is invoked without "wlock" from: - clone in mq - pullrebase in rebase - postincoming in commands (used in "hg pull -u", "hg unbundle") - update in commands This patch puts almost all original "hgupdaterepo" implementation into "_hgupdaterepo" to reduce changes.
hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py	Fri Aug 15 14:33:19 2014 +0900
+++ b/hgext/largefiles/overrides.py	Fri Aug 15 20:28:51 2014 +0900
@@ -696,6 +696,13 @@
         wlock.release()
 
 def hgupdaterepo(orig, repo, node, overwrite):
+    wlock = repo.wlock()
+    try:
+        return _hgupdaterepo(orig, repo, node, overwrite)
+    finally:
+        wlock.release()
+
+def _hgupdaterepo(orig, repo, node, overwrite):
     if not overwrite:
         # Only call updatelfiles on the standins that have changed to save time
         oldstandins = lfutil.getstandinsstate(repo)