Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
repo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YongjieWang
repo
Commits
2073342d
Commit
2073342d
authored
Apr 22, 2016
by
Erwan Yvin
Committed by
Matthias Putz
Jun 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: replacing shutils.rmtree with portable rmtree due to problem #34
parent
8b3ee8e2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
11 deletions
+20
-11
portable.py
portable.py
+9
-2
project.py
project.py
+6
-6
gitc_delete.py
subcmds/gitc_delete.py
+1
-1
init.py
subcmds/init.py
+1
-1
sync.py
subcmds/sync.py
+3
-1
No files found.
portable.py
View file @
2073342d
...
...
@@ -20,8 +20,15 @@ if isUnix():
def
to_windows_path
(
path
):
return
path
.
replace
(
'/'
,
'
\\
'
)
def
rmtree
(
path
):
shutil
.
rmtree
(
path
,
onerror
=
onerror
)
def
rmtree
(
top
):
for
root
,
dirs
,
files
in
os
.
walk
(
top
,
topdown
=
False
):
for
name
in
files
:
filename
=
os
.
path
.
join
(
root
,
name
)
os
.
chmod
(
filename
,
stat
.
S_IWRITE
)
os
.
remove
(
filename
)
for
name
in
dirs
:
rmtree
(
os
.
path
.
join
(
root
,
name
))
os
.
rmdir
(
top
)
def
rename
(
src
,
dst
):
if
isUnix
():
...
...
project.py
View file @
2073342d
...
...
@@ -2166,10 +2166,10 @@ class Project(object):
if
force_sync
:
print
(
"Retrying clone after deleting
%
s"
%
self
.
gitdir
,
file
=
sys
.
stderr
)
try
:
shutil
.
rmtree
(
os
.
path
.
realpath
(
self
.
gitdir
))
portable
.
rmtree
(
os
.
path
.
realpath
(
self
.
gitdir
))
if
self
.
worktree
and
os
.
path
.
exists
(
os
.
path
.
realpath
(
self
.
worktree
)):
shutil
.
rmtree
(
os
.
path
.
realpath
(
self
.
worktree
))
portable
.
rmtree
(
os
.
path
.
realpath
(
self
.
worktree
))
return
self
.
_InitGitDir
(
mirror_git
=
mirror_git
,
force_sync
=
False
)
except
:
raise
e
...
...
@@ -2210,9 +2210,9 @@ class Project(object):
self
.
config
.
SetString
(
'core.bare'
,
None
)
except
Exception
:
if
init_obj_dir
and
os
.
path
.
exists
(
self
.
objdir
):
shutil
.
rmtree
(
self
.
objdir
)
portable
.
rmtree
(
self
.
objdir
)
if
init_git_dir
and
os
.
path
.
exists
(
self
.
gitdir
):
shutil
.
rmtree
(
self
.
gitdir
)
portable
.
rmtree
(
self
.
gitdir
)
raise
def
_UpdateHooks
(
self
):
...
...
@@ -2384,7 +2384,7 @@ class Project(object):
except
GitError
as
e
:
if
force_sync
:
try
:
shutil
.
rmtree
(
dotgit
)
portable
.
rmtree
(
dotgit
)
return
self
.
_InitWorkTree
(
force_sync
=
False
)
except
:
raise
e
...
...
@@ -2402,7 +2402,7 @@ class Project(object):
self
.
_CopyAndLinkFiles
()
except
Exception
:
if
init_dotgit
:
#
shutil
.rmtree(dotgit)
#
portable
.rmtree(dotgit)
portable
.
rmtree
(
dotgit
)
raise
...
...
subcmds/gitc_delete.py
View file @
2073342d
...
...
@@ -52,4 +52,4 @@ and all locally downloaded sources.
if
not
response
==
'yes'
:
print
(
'Response was not "yes"
\n
Exiting...'
)
sys
.
exit
(
1
)
shutil
.
rmtree
(
self
.
gitc_manifest
.
gitc_client_dir
)
portable
.
rmtree
(
self
.
gitc_manifest
.
gitc_client_dir
)
subcmds/init.py
View file @
2073342d
...
...
@@ -229,7 +229,7 @@ to update the working directory files.
# Better delete the manifest git dir if we created it; otherwise next
# time (when user fixes problems) we won't go through the "is_new" logic.
if
is_new
:
shutil
.
rmtree
(
m
.
gitdir
)
portable
.
rmtree
(
m
.
gitdir
)
sys
.
exit
(
1
)
if
opt
.
manifest_branch
:
...
...
subcmds/sync.py
View file @
2073342d
...
...
@@ -19,12 +19,14 @@ import netrc
from
optparse
import
SUPPRESS_HELP
import
os
import
re
import
portable
import
shutil
import
socket
import
subprocess
import
sys
import
tempfile
import
time
import
stat
from
pyversion
import
is_python3
if
is_python3
():
...
...
@@ -490,7 +492,7 @@ later is required to fix a server side protocol bug.
else
:
print
(
'Deleting obsolete path
%
s'
%
project
.
worktree
,
file
=
sys
.
stderr
)
shutil
.
rmtree
(
project
.
worktree
)
portable
.
rmtree
(
project
.
worktree
)
# Try deleting parent subdirs if they are empty
project_dir
=
os
.
path
.
dirname
(
project
.
worktree
)
while
project_dir
!=
self
.
manifest
.
topdir
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment