Mercurial > hg
changeset 21983:52d34d5415c9
purge: prefer util.unlink instead over own removefile
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Sat, 02 Aug 2014 09:45:21 +0100 |
parents | 97d5aca9bb66 |
children | 977a0b9af5ac |
files | hgext/purge.py |
diffstat | 1 files changed, 1 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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 @@ 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):