Patchwork [2,of,5] largefiles: put whole "hgmerge" process into the same "wlock" scope

mail settings
Submitter Katsunori FUJIWARA
Date Aug. 15, 2014, 11:32 a.m.
Message ID <c257a3b4fe4190c1b6cd.1408102332@feefifofum>
Download mbox | patch
Permalink /patch/5408/
State Accepted
Headers show


Katsunori FUJIWARA - Aug. 15, 2014, 11:32 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <>
# Date 1408102131 -32400
#      Fri Aug 15 20:28:51 2014 +0900
# Node ID c257a3b4fe4190c1b6cda43ca29a589b9be3fde7
# Parent  0dff07b4d9d070825c83b47a672b316aab22bae7
largefiles: put whole "hgmerge" process into the same "wlock" scope

Before this patch, there are two distinct "wlock" scopes below in

  1. "merge.update" via original "hg.merge" function
  2. "updatelfiles" specific "wlock" scope (to synchronize largefile

But these should be executed in the same "wlock" scope for
consistency, because user of "hg.merge" doesn't get "wlock" explicitly
before invocation of it.

  - merge in commands

This patch puts almost all original "hgmerge" implementation into
"_hgmerge" to reduce changes.


diff --git a/hgext/largefiles/ b/hgext/largefiles/
--- a/hgext/largefiles/
+++ b/hgext/largefiles/
@@ -717,6 +717,13 @@ 
     return result
 def hgmerge(orig, repo, node, force=None, remind=True):
+    wlock = repo.wlock()
+    try:
+        return _hgmerge(orig, repo, node, force, remind)
+    finally:
+        wlock.release()
+def _hgmerge(orig, repo, node, force, remind):
     result = orig(repo, node, force, remind)
     lfcommands.updatelfiles(repo.ui, repo)
     return result