Patchwork D642: checknlink: rename file object from 'fd' to 'fp'

login
register
mail settings
Submitter phabricator
Date Sept. 7, 2017, 2:54 p.m.
Message ID <15476994f6b6a76b16e919b50fb30719@localhost.localdomain>
Download mbox | patch
Permalink /patch/23721/
State Not Applicable
Headers show

Comments

phabricator - Sept. 7, 2017, 2:54 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6c5cdb02f2f9: checknlink: rename file object from 'fd' to 'fp' (authored by quark).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D642?vs=1639&id=1664

REVISION DETAIL
  https://phab.mercurial-scm.org/D642

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS




To: quark, #hg-reviewers, phillco
Cc: phillco, mercurial-devel

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1457,24 +1457,23 @@ 
 
     # testfile may be open, so we need a separate file for checking to
     # work around issue2543 (or testfile may get lost on Samba shares)
-    f1, f2, fd = None, None, None
+    f1, f2, fp = None, None, None
     try:
         fd, f1 = tempfile.mkstemp(prefix='.%s-' % os.path.basename(testfile),
                                   suffix='1~', dir=os.path.dirname(testfile))
         os.close(fd)
-        fd = None
         f2 = '%s2~' % f1[:-2]
 
         oslink(f1, f2)
         # nlinks() may behave differently for files on Windows shares if
         # the file is open.
-        fd = posixfile(f2)
+        fp = posixfile(f2)
         return nlinks(f2) > 1
     except OSError:
         return False
     finally:
-        if fd is not None:
-            fd.close()
+        if fp is not None:
+            fp.close()
         for f in (f1, f2):
             try:
                 if f is not None: