summaryrefslogtreecommitdiffstats
path: root/subcmds/init.py
diff options
context:
space:
mode:
authorRenaud Paquay <rpaquay@google.com>2016-11-03 10:37:53 -0700
committerDavid Pursehouse <dpursehouse@collab.net>2017-05-29 19:32:31 +0900
commita65adf74f990eeac0d90011476376c7239cb7af5 (patch)
tree9278d9ce7c8d68a85dd049ed1ea5b64d84135fc0 /subcmds/init.py
parentd5cec5e752821ca2710101b626b3a3ca07fdb7f8 (diff)
downloadgit-repo-a65adf74f990eeac0d90011476376c7239cb7af5.tar.gz
Workaround shutil.rmtree limitation on Windows
By default, shutil.rmtree raises an exception when deleting readonly files on Windows. Replace all shutil.rmtree with platform_utils.rmtree, which adds an error handler to make files read-write when they can't be deleted. Change-Id: I9cfea9a7b3703fb16a82cf69331540c2c179ed53
Diffstat (limited to 'subcmds/init.py')
-rw-r--r--subcmds/init.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index 65dfd1fd..e6470916 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -17,7 +17,6 @@ from __future__ import print_function
17import os 17import os
18import platform 18import platform
19import re 19import re
20import shutil
21import sys 20import sys
22 21
23from pyversion import is_python3 22from pyversion import is_python3
@@ -35,6 +34,7 @@ from error import ManifestParseError
35from project import SyncBuffer 34from project import SyncBuffer
36from git_config import GitConfig 35from git_config import GitConfig
37from git_command import git_require, MIN_GIT_VERSION 36from git_command import git_require, MIN_GIT_VERSION
37import platform_utils
38 38
39class Init(InteractiveCommand, MirrorSafeCommand): 39class Init(InteractiveCommand, MirrorSafeCommand):
40 common = True 40 common = True
@@ -252,7 +252,7 @@ to update the working directory files.
252 # Better delete the manifest git dir if we created it; otherwise next 252 # Better delete the manifest git dir if we created it; otherwise next
253 # time (when user fixes problems) we won't go through the "is_new" logic. 253 # time (when user fixes problems) we won't go through the "is_new" logic.
254 if is_new: 254 if is_new:
255 shutil.rmtree(m.gitdir) 255 platform_utils.rmtree(m.gitdir)
256 sys.exit(1) 256 sys.exit(1)
257 257
258 if opt.manifest_branch: 258 if opt.manifest_branch: