Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
Hdlmake
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
15
Issues
15
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Hdlmake
Commits
59ad6073
Commit
59ad6073
authored
Mar 27, 2019
by
William Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup git.py. remove unused basename code. Check submodule status line is not None.
parent
fb5f6d1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
git.py
hdlmake/fetch/git.py
+6
-4
No files found.
hdlmake/fetch/git.py
View file @
59ad6073
...
...
@@ -54,6 +54,8 @@ class Git(Fetcher):
def
get_submodule_commit
(
submodule_dir
):
"""Get the commit for a repository if defined in Git submodules"""
status_line
=
shell
.
run
(
"git submodule status
%
s"
%
submodule_dir
)
if
status_line
is
None
:
return
None
status_line
=
status_line
.
split
()
if
len
(
status_line
)
==
2
or
len
(
status_line
)
==
3
:
if
status_line
[
0
][
0
]
in
[
'-'
,
'+'
,
'U'
]:
...
...
@@ -69,11 +71,8 @@ class Git(Fetcher):
logging
.
debug
(
"Fetchto = '{}'"
.
format
(
fetchto
))
if
not
os
.
path
.
exists
(
fetchto
):
os
.
mkdir
(
fetchto
)
basename
=
path_utils
.
url_basename
(
module
.
url
)
if
basename
.
endswith
(
".git"
):
basename
=
basename
[:
-
4
]
# remove trailing .git
if
not
module
.
isfetched
:
logging
.
info
(
"
Fetch
ing git module
%
s to
%
s"
,
module
.
url
,
module
.
path
)
logging
.
info
(
"
Clon
ing git module
%
s to
%
s"
,
module
.
url
,
module
.
path
)
cmd
=
"(git clone {1} {2})"
cmd
=
cmd
.
format
(
fetchto
,
module
.
url
,
module
.
path
)
logging
.
info
(
cmd
)
...
...
@@ -81,6 +80,7 @@ class Git(Fetcher):
return
False
else
:
logging
.
info
(
"Updating git module
%
s"
,
module
.
path
)
checkout_id
=
None
if
module
.
branch
is
not
None
:
checkout_id
=
module
.
branch
...
...
@@ -91,12 +91,14 @@ class Git(Fetcher):
else
:
checkout_id
=
self
.
get_submodule_commit
(
module
.
path
)
logging
.
debug
(
"Git submodule commit:
%
s"
,
checkout_id
)
if
checkout_id
is
not
None
:
logging
.
info
(
"Checking out version
%
s"
,
checkout_id
)
cmd
=
"(cd {0} && git checkout {1})"
cmd
=
cmd
.
format
(
module
.
path
,
checkout_id
)
if
os
.
system
(
cmd
)
!=
0
:
return
False
if
self
.
submodule
and
not
module
.
isfetched
:
cmd
=
(
"(cd {0} && git submodule init &&"
"git submodule update --recursive)"
)
...
...
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