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
Show 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():
...
@@ -20,8 +20,15 @@ if isUnix():
def
to_windows_path
(
path
):
def
to_windows_path
(
path
):
return
path
.
replace
(
'/'
,
'
\\
'
)
return
path
.
replace
(
'/'
,
'
\\
'
)
def
rmtree
(
path
):
def
rmtree
(
top
):
shutil
.
rmtree
(
path
,
onerror
=
onerror
)
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
):
def
rename
(
src
,
dst
):
if
isUnix
():
if
isUnix
():
...
...
project.py
View file @
2073342d
...
@@ -2166,10 +2166,10 @@ class Project(object):
...
@@ -2166,10 +2166,10 @@ class Project(object):
if
force_sync
:
if
force_sync
:
print
(
"Retrying clone after deleting
%
s"
%
self
.
gitdir
,
file
=
sys
.
stderr
)
print
(
"Retrying clone after deleting
%
s"
%
self
.
gitdir
,
file
=
sys
.
stderr
)
try
:
try
:
shutil
.
rmtree
(
os
.
path
.
realpath
(
self
.
gitdir
))
portable
.
rmtree
(
os
.
path
.
realpath
(
self
.
gitdir
))
if
self
.
worktree
and
os
.
path
.
exists
(
if
self
.
worktree
and
os
.
path
.
exists
(
os
.
path
.
realpath
(
self
.
worktree
)):
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
)
return
self
.
_InitGitDir
(
mirror_git
=
mirror_git
,
force_sync
=
False
)
except
:
except
:
raise
e
raise
e
...
@@ -2210,9 +2210,9 @@ class Project(object):
...
@@ -2210,9 +2210,9 @@ class Project(object):
self
.
config
.
SetString
(
'core.bare'
,
None
)
self
.
config
.
SetString
(
'core.bare'
,
None
)
except
Exception
:
except
Exception
:
if
init_obj_dir
and
os
.
path
.
exists
(
self
.
objdir
):
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
):
if
init_git_dir
and
os
.
path
.
exists
(
self
.
gitdir
):
shutil
.
rmtree
(
self
.
gitdir
)
portable
.
rmtree
(
self
.
gitdir
)
raise
raise
def
_UpdateHooks
(
self
):
def
_UpdateHooks
(
self
):
...
@@ -2384,7 +2384,7 @@ class Project(object):
...
@@ -2384,7 +2384,7 @@ class Project(object):
except
GitError
as
e
:
except
GitError
as
e
:
if
force_sync
:
if
force_sync
:
try
:
try
:
shutil
.
rmtree
(
dotgit
)
portable
.
rmtree
(
dotgit
)
return
self
.
_InitWorkTree
(
force_sync
=
False
)
return
self
.
_InitWorkTree
(
force_sync
=
False
)
except
:
except
:
raise
e
raise
e
...
@@ -2402,7 +2402,7 @@ class Project(object):
...
@@ -2402,7 +2402,7 @@ class Project(object):
self
.
_CopyAndLinkFiles
()
self
.
_CopyAndLinkFiles
()
except
Exception
:
except
Exception
:
if
init_dotgit
:
if
init_dotgit
:
#
shutil
.rmtree(dotgit)
#
portable
.rmtree(dotgit)
portable
.
rmtree
(
dotgit
)
portable
.
rmtree
(
dotgit
)
raise
raise
...
...
subcmds/gitc_delete.py
View file @
2073342d
...
@@ -52,4 +52,4 @@ and all locally downloaded sources.
...
@@ -52,4 +52,4 @@ and all locally downloaded sources.
if
not
response
==
'yes'
:
if
not
response
==
'yes'
:
print
(
'Response was not "yes"
\n
Exiting...'
)
print
(
'Response was not "yes"
\n
Exiting...'
)
sys
.
exit
(
1
)
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.
...
@@ -229,7 +229,7 @@ to update the working directory files.
# Better delete the manifest git dir if we created it; otherwise next
# 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.
# time (when user fixes problems) we won't go through the "is_new" logic.
if
is_new
:
if
is_new
:
shutil
.
rmtree
(
m
.
gitdir
)
portable
.
rmtree
(
m
.
gitdir
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
if
opt
.
manifest_branch
:
if
opt
.
manifest_branch
:
...
...
subcmds/sync.py
View file @
2073342d
...
@@ -19,12 +19,14 @@ import netrc
...
@@ -19,12 +19,14 @@ import netrc
from
optparse
import
SUPPRESS_HELP
from
optparse
import
SUPPRESS_HELP
import
os
import
os
import
re
import
re
import
portable
import
shutil
import
shutil
import
socket
import
socket
import
subprocess
import
subprocess
import
sys
import
sys
import
tempfile
import
tempfile
import
time
import
time
import
stat
from
pyversion
import
is_python3
from
pyversion
import
is_python3
if
is_python3
():
if
is_python3
():
...
@@ -490,7 +492,7 @@ later is required to fix a server side protocol bug.
...
@@ -490,7 +492,7 @@ later is required to fix a server side protocol bug.
else
:
else
:
print
(
'Deleting obsolete path
%
s'
%
project
.
worktree
,
print
(
'Deleting obsolete path
%
s'
%
project
.
worktree
,
file
=
sys
.
stderr
)
file
=
sys
.
stderr
)
shutil
.
rmtree
(
project
.
worktree
)
portable
.
rmtree
(
project
.
worktree
)
# Try deleting parent subdirs if they are empty
# Try deleting parent subdirs if they are empty
project_dir
=
os
.
path
.
dirname
(
project
.
worktree
)
project_dir
=
os
.
path
.
dirname
(
project
.
worktree
)
while
project_dir
!=
self
.
manifest
.
topdir
:
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