##// END OF EJS Templates
purge: prefer util.unlink instead over own removefile
Christian Ebert -
r21983:52d34d54 default
parent child Browse files
Show More
@@ -95,17 +95,6 b' def purge(ui, repo, *dirs, **opts):'
95 95 else:
96 96 ui.write('%s%s' % (name, eol))
97 97
98 def removefile(path):
99 try:
100 os.remove(path)
101 except OSError:
102 # read-only files cannot be unlinked under Windows
103 s = os.stat(path)
104 if (s.st_mode & stat.S_IWRITE) != 0:
105 raise
106 os.chmod(path, stat.S_IMODE(s.st_mode) | stat.S_IWRITE)
107 os.remove(path)
108
109 98 directories = []
110 99 match = scmutil.match(repo[None], dirs, opts)
111 100 match.explicitdir = match.traversedir = directories.append
@@ -115,7 +104,7 b' def purge(ui, repo, *dirs, **opts):'
115 104 for f in sorted(status[4] + status[5]):
116 105 if act:
117 106 ui.note(_('removing file %s\n') % f)
118 remove(removefile, f)
107 remove(util.unlink, f)
119 108
120 109 if removedirs:
121 110 for f in sorted(directories, reverse=True):
General Comments 0
You need to be logged in to leave comments. Login now