Show More
@@ -6,7 +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 copy |
|
8 | import copy | |
9 |
import errno, os, re, |
|
9 | import errno, os, re, posixpath, sys | |
10 | import xml.dom.minidom |
|
10 | import xml.dom.minidom | |
11 | import stat, subprocess, tarfile |
|
11 | import stat, subprocess, tarfile | |
12 | from i18n import _ |
|
12 | from i18n import _ | |
@@ -779,7 +779,8 b' class hgsubrepo(abstractsubrepo):' | |||||
779 | self.ui.status(_('cloning subrepo %s from %s\n') |
|
779 | self.ui.status(_('cloning subrepo %s from %s\n') | |
780 | % (subrelpath(self), srcurl)) |
|
780 | % (subrelpath(self), srcurl)) | |
781 | parentrepo = self._repo._subparent |
|
781 | parentrepo = self._repo._subparent | |
782 | shutil.rmtree(self._repo.path) |
|
782 | # use self._repo.vfs instead of self.wvfs to remove .hg only | |
|
783 | self._repo.vfs.rmtree() | |||
783 | other, cloned = hg.clone(self._repo._subparent.baseui, {}, |
|
784 | other, cloned = hg.clone(self._repo._subparent.baseui, {}, | |
784 | other, self._repo.root, |
|
785 | other, self._repo.root, | |
785 | update=False) |
|
786 | update=False) | |
@@ -1114,18 +1115,8 b' class svnsubrepo(abstractsubrepo):' | |||||
1114 | return |
|
1115 | return | |
1115 | self.ui.note(_('removing subrepo %s\n') % self._path) |
|
1116 | self.ui.note(_('removing subrepo %s\n') % self._path) | |
1116 |
|
1117 | |||
1117 | def onerror(function, path, excinfo): |
|
|||
1118 | if function is not os.remove: |
|
|||
1119 | raise |
|
|||
1120 | # read-only files cannot be unlinked under Windows |
|
|||
1121 | s = os.stat(path) |
|
|||
1122 | if (s.st_mode & stat.S_IWRITE) != 0: |
|
|||
1123 | raise |
|
|||
1124 | os.chmod(path, stat.S_IMODE(s.st_mode) | stat.S_IWRITE) |
|
|||
1125 | os.remove(path) |
|
|||
1126 |
|
||||
1127 | path = self._ctx.repo().wjoin(self._path) |
|
1118 | path = self._ctx.repo().wjoin(self._path) | |
1128 | shutil.rmtree(path, onerror=onerror) |
|
1119 | self.wvfs.rmtree(forcibly=True) | |
1129 | try: |
|
1120 | try: | |
1130 | os.removedirs(os.path.dirname(path)) |
|
1121 | os.removedirs(os.path.dirname(path)) | |
1131 | except OSError: |
|
1122 | except OSError: | |
@@ -1637,7 +1628,7 b' class gitsubrepo(abstractsubrepo):' | |||||
1637 | continue |
|
1628 | continue | |
1638 | path = os.path.join(self._abspath, f) |
|
1629 | path = os.path.join(self._abspath, f) | |
1639 | if kind == stat.S_IFDIR: |
|
1630 | if kind == stat.S_IFDIR: | |
1640 |
s |
|
1631 | self.wvfs.rmtree(f) | |
1641 | else: |
|
1632 | else: | |
1642 | os.remove(path) |
|
1633 | os.remove(path) | |
1643 |
|
1634 |
General Comments 0
You need to be logged in to leave comments.
Login now