Patchwork [2,of,2] filemerge: better handling of failing remove of temporary files

login
register
mail settings
Submitter Mads Kiilerich
Date April 17, 2014, 1:52 p.m.
Message ID <07a19bb1002efb2f3319.1397742720@localhost.localdomain>
Download mbox | patch
Permalink /patch/4394/
State Accepted
Commit 098a274764b3813ca0788728d88187d21b9785e5
Headers show

Comments

Mads Kiilerich - April 17, 2014, 1:52 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1397739286 -7200
#      Thu Apr 17 14:54:46 2014 +0200
# Node ID 07a19bb1002efb2f331978148c9c769f1f268150
# Parent  c0c725c599f60c7d17e943e25626990b3523836b
filemerge: better handling of failing remove of temporary files

We have seen some failures on Windows that could seem like the unlinks of
temporary files were failing. That could perhaps be because the merge tool
somehow still held the files open.

Instead of the bare bone os.unlink, use our util.unlink with special
rename/retry handling on Windows.
Matt Mackall - April 17, 2014, 4 p.m.
On Thu, 2014-04-17 at 15:52 +0200, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1397739286 -7200
> #      Thu Apr 17 14:54:46 2014 +0200
> # Node ID 07a19bb1002efb2f331978148c9c769f1f268150
> # Parent  c0c725c599f60c7d17e943e25626990b3523836b
> filemerge: better handling of failing remove of temporary files

These are queued for default, thanks.

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -334,10 +334,10 @@  def filemerge(repo, mynode, orig, fcd, f
             if onfailure:
                 ui.warn(onfailure % fd)
         else:
-            os.unlink(back)
+            util.unlink(back)
 
-        os.unlink(b)
-        os.unlink(c)
+        util.unlink(b)
+        util.unlink(c)
         return r
 
     if not r and (_toolbool(ui, tool, "checkconflicts") or
@@ -368,10 +368,10 @@  def filemerge(repo, mynode, orig, fcd, f
         if onfailure:
             ui.warn(onfailure % fd)
     else:
-        os.unlink(back)
+        util.unlink(back)
 
-    os.unlink(b)
-    os.unlink(c)
+    util.unlink(b)
+    util.unlink(c)
     return r
 
 # tell hggettext to extract docstrings from these functions: