Patchwork [1,of,8] transaction: unlink target file via vfs

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Nov. 12, 2013, 7:31 a.m.
Message ID <14845c83e5e7113b689b.1384241510@juju>
Download mbox | patch
Permalink /patch/2926/
State Accepted
Commit a3378a1b0a05b17d7c92f19af2921588ce6c7c92
Headers show

Comments

Katsunori FUJIWARA - Nov. 12, 2013, 7:31 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1384241032 -32400
#      Tue Nov 12 16:23:52 2013 +0900
# Node ID 14845c83e5e7113b689b36ba49c931c7b8f4945e
# Parent  c38c3fdc8b9317ba09e03ab09364c3800da7c50c
transaction: unlink target file via vfs

Before this patch, unlink target file is once opened before unlinking,
because "opener" before vfs migration doesn't have "unlink()"
function.

This patch uses "vfs.unlink()" instead of "open()" and "fp.name".

Patch

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -35,10 +35,7 @@ 
                 raise
         else:
             try:
-                fp = opener(f)
-                fn = fp.name
-                fp.close()
-                util.unlink(fn)
+                opener.unlink(f)
             except (IOError, OSError), inst:
                 if inst.errno != errno.ENOENT:
                     raise