[PATCH 3 of 3] purge: prefer util.unlink instead over own removefile
Christian Ebert
blacktrash at gmx.net
Sat Aug 2 08:48:33 UTC 2014
# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1406969121 -3600
# Sat Aug 02 09:45:21 2014 +0100
# Node ID 3703e7ec0657059cb741236dac1b6b1e4075e7d5
# Parent 76feb88784ff48008b95faa339f3717debc41137
purge: prefer util.unlink instead over own removefile
diff -r 76feb88784ff -r 3703e7ec0657 hgext/purge.py
--- a/hgext/purge.py Sat Aug 02 09:44:45 2014 +0100
+++ b/hgext/purge.py Sat Aug 02 09:45:21 2014 +0100
@@ -95,17 +95,6 @@ def purge(ui, repo, *dirs, **opts):
else:
ui.write('%s%s' % (name, eol))
- def removefile(path):
- try:
- os.remove(path)
- except OSError:
- # read-only files cannot be unlinked under Windows
- s = os.stat(path)
- if (s.st_mode & stat.S_IWRITE) != 0:
- raise
- os.chmod(path, stat.S_IMODE(s.st_mode) | stat.S_IWRITE)
- os.remove(path)
-
directories = []
match = scmutil.match(repo[None], dirs, opts)
match.explicitdir = match.traversedir = directories.append
@@ -115,7 +104,7 @@ def purge(ui, repo, *dirs, **opts):
for f in sorted(status[4] + status[5]):
if act:
ui.note(_('removing file %s\n') % f)
- remove(removefile, f)
+ remove(util.unlink, f)
if removedirs:
for f in sorted(directories, reverse=True):
More information about the Mercurial-devel
mailing list