##// END OF EJS Templates
subrepo: fix removing read-only svn files on Windows
Patrick Mezard -
r13013:92b0d669 stable
parent child Browse files
Show More
@@ -6,6 +6,7 b''
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 import errno, os, re, xml.dom.minidom, shutil, urlparse, posixpath
8 import errno, os, re, xml.dom.minidom, shutil, urlparse, posixpath
9 import stat
9 from i18n import _
10 from i18n import _
10 import config, util, node, error, cmdutil
11 import config, util, node, error, cmdutil
11 hg = None
12 hg = None
@@ -549,7 +550,18 b' class svnsubrepo(abstractsubrepo):'
549 'it has changes.\n' % self._path))
550 'it has changes.\n' % self._path))
550 return
551 return
551 self._ui.note(_('removing subrepo %s\n') % self._path)
552 self._ui.note(_('removing subrepo %s\n') % self._path)
552 shutil.rmtree(self._ctx._repo.wjoin(self._path))
553
554 def onerror(function, path, excinfo):
555 if function is not os.remove:
556 raise
557 # read-only files cannot be unlinked under Windows
558 s = os.stat(path)
559 if (s.st_mode & stat.S_IWRITE) != 0:
560 raise
561 os.chmod(path, stat.S_IMODE(s.st_mode) | stat.S_IWRITE)
562 os.remove(path)
563
564 shutil.rmtree(self._ctx._repo.wjoin(self._path), onerror=onerror)
553
565
554 def get(self, state):
566 def get(self, state):
555 status = self._svncommand(['checkout', state[0], '--revision', state[1]])
567 status = self._svncommand(['checkout', state[0], '--revision', state[1]])
General Comments 0
You need to be logged in to leave comments. Login now