Patchwork [1,of,5,STABLE] largefiles: put whole rollback-ing process into the same "wlock" scope

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Aug. 11, 2014, 1:39 p.m.
Message ID <1165734dd845bfb6cf93.1407764379@feefifofum>
Download mbox | patch
Permalink /patch/5338/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - Aug. 11, 2014, 1:39 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1407763783 -32400
#      Mon Aug 11 22:29:43 2014 +0900
# Branch stable
# Node ID 1165734dd845bfb6cf93c8f6f7adad454be566c4
# Parent  1e392c63fb76a4fe389c90c90b2db594c637a57f
largefiles: put whole rollback-ing process into the same "wlock" scope

Before this patch, there are three distinct "wlock" scopes in
"overriderollback":

  1. "localrepository.rollback" via original "rollback" command,
  2. "merge.update" for reverting standin files only, and
  3. "overriderollback" specific "wlock" scope (to synchronize
     largefile dirstate)

But these should be executed in the same "wlock" scope for
consistency.

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -1140,11 +1140,12 @@ 
     repo.status = oldstatus
 
 def overriderollback(orig, ui, repo, **opts):
-    result = orig(ui, repo, **opts)
-    merge.update(repo, node=None, branchmerge=False, force=True,
-        partial=lfutil.isstandin)
     wlock = repo.wlock()
     try:
+        result = orig(ui, repo, **opts)
+        merge.update(repo, node=None, branchmerge=False, force=True,
+                     partial=lfutil.isstandin)
+
         lfdirstate = lfutil.openlfdirstate(ui, repo)
         lfiles = lfutil.listlfiles(repo)
         oldlfiles = lfutil.listlfiles(repo, repo[None].parents()[0].rev())