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
65be4a9e
Commit
65be4a9e
authored
Aug 09, 2016
by
Javier D. Garcia-Lasheras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some more coding style improvements to fetch.git
parent
ed7a57c8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
+12
-13
git.py
hdlmake/fetch/git.py
+12
-13
No files found.
hdlmake/fetch/git.py
View file @
65be4a9e
...
...
@@ -22,9 +22,8 @@
"""Module providing the stuff for handling Git repositories"""
import
os
from
hdlmake.util
import
path
from
hdlmake.util
import
path
as
path_utils
import
logging
import
platform
from
tempfile
import
TemporaryFile
from
subprocess
import
Popen
,
PIPE
from
.constants
import
GIT
...
...
@@ -44,7 +43,7 @@ class Git(Fetcher):
"""Get the top level for the Git repository"""
cur_dir
=
module
.
pool
.
top_module
.
path
try
:
os
.
chdir
(
path
.
rel2abs
(
module
.
path
))
os
.
chdir
(
path
_utils
.
rel2abs
(
module
.
path
))
if
not
os
.
path
.
exists
(
".gitmodules"
):
return
None
tree_root_cmd
=
Popen
(
"git rev-parse --show-toplevel"
,
...
...
@@ -66,9 +65,9 @@ class Git(Fetcher):
cur_dir
=
module
.
pool
.
top_module
.
path
if
module
.
branch
is
None
:
module
.
branch
=
"master"
basename
=
path
.
url_basename
(
module
.
url
)
basename
=
path
_utils
.
url_basename
(
module
.
url
)
mod_path
=
os
.
path
.
join
(
fetchto
,
basename
)
logging
.
info
(
"Fetching git module:
%
s"
%
mod_path
)
logging
.
info
(
"Fetching git module:
%
s"
,
mod_path
)
if
basename
.
endswith
(
".git"
):
basename
=
basename
[:
-
4
]
# remove trailing .git
if
module
.
isfetched
:
...
...
@@ -76,22 +75,22 @@ class Git(Fetcher):
else
:
update_only
=
False
if
update_only
:
logging
.
info
(
"Updating module
%
s"
%
mod_path
)
logging
.
info
(
"Updating module
%
s"
,
mod_path
)
cmd
=
"(cd {0} && git checkout {1})"
cmd
=
cmd
.
format
(
mod_path
,
module
.
branch
)
else
:
logging
.
info
(
"Cloning module
%
s"
%
mod_path
)
logging
.
info
(
"Cloning module
%
s"
,
mod_path
)
cmd
=
"(cd {0} && git clone -b {2} {1})"
cmd
=
cmd
.
format
(
fetchto
,
module
.
url
,
module
.
branch
)
success
=
True
logging
.
debug
(
"Running
%
s"
%
cmd
)
logging
.
debug
(
"Running
%
s"
,
cmd
)
if
os
.
system
(
cmd
)
!=
0
:
success
=
False
if
module
.
revision
is
not
None
and
success
is
True
:
logging
.
debug
(
"cd
%
s"
%
mod_path
)
logging
.
debug
(
"cd
%
s"
,
mod_path
)
os
.
chdir
(
mod_path
)
cmd
=
"git checkout "
+
module
.
revision
logging
.
debug
(
"Running
%
s"
%
cmd
)
logging
.
debug
(
"Running
%
s"
,
cmd
)
if
os
.
system
(
cmd
)
!=
0
:
success
=
False
os
.
chdir
(
cur_dir
)
...
...
@@ -106,7 +105,7 @@ class Git(Fetcher):
commit
=
None
stderr
=
TemporaryFile
()
try
:
is_windows
=
path
.
check_windows
()
is_windows
=
path
_utils
.
check_windows
()
os
.
chdir
(
path
)
git_cmd
=
'git log -1 --format="
%
H" | cut -c1-32'
git_out
=
Popen
(
git_cmd
,
...
...
@@ -118,8 +117,8 @@ class Git(Fetcher):
errmsg
=
stderr
.
readlines
()
if
errmsg
:
logging
.
debug
(
"git error message (in
%
s):
%
s"
%
(
path
,
'
\n
'
.
join
(
errmsg
)
))
"git error message (in
%
s):
%
s"
,
path
,
'
\n
'
.
join
(
errmsg
))
try
:
commit
=
git_out
.
stdout
.
readlines
()[
0
]
.
strip
()
except
IndexError
:
...
...
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