D588: win32: use fewer system calls for unlink()

quark (Jun Wu) phabricator at mercurial-scm.org
Fri Sep 1 19:19:41 EDT 2017


quark requested changes to this revision.
quark added a comment.
This revision now requires changes to proceed.


  I can confirm `os.unlink` may succeed without actually removing the file:
  
    >>> from mercurial import util
    >>> f=util.posixfile('c:\\users\\quark\\a.txt', 'w')
    >>> os.unlink('c:\\users\\quark\\a.txt') # success, but file is still there
    >>> f.close() # removes the file

INLINE COMMENTS

> win32.py:542
> +    try:
> +        os.unlink(f)
> +        return

This succeeded, but the file still exists and cannot be renamed.

REPOSITORY
  rHG Mercurial

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

To: indygreg, #hg-reviewers, quark
Cc: durin42, quark, mercurial-devel


More information about the Mercurial-devel mailing list