Skip to content

Commit

Permalink
Merge pull request #227 from code-disaster/update-check-for-repo
Browse files Browse the repository at this point in the history
make 'fips update' check for existing git repository
  • Loading branch information
floooh authored Jun 20, 2019
2 parents 57377f9 + ab882e3 commit d0194ee
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions mod/dep.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,19 +523,21 @@ def _rec_update_imports(fips_dir, proj_dir, handled) :
log.colored(log.YELLOW, "=== dependency: '{}':".format(dep_proj_name))
dep_ok = False
if os.path.isdir(dep_proj_dir) :
# directory did not exist, do a fresh git clone
dep = imports[dep_proj_name]
git_commit = None if 'rev' not in dep else dep['rev']
if git.has_local_changes(dep_proj_dir) :
log.warn(" '{}' has local changes, skipping...".format(dep_proj_dir))
if os.path.isdir("{}/.git".format(dep_proj_dir)) :
dep = imports[dep_proj_name]
git_commit = None if 'rev' not in dep else dep['rev']
if git.has_local_changes(dep_proj_dir) :
log.warn(" '{}' has local changes, skipping...".format(dep_proj_dir))
else :
log.colored(log.BLUE, " updating '{}'...".format(dep_proj_dir))
git.update(dep_proj_dir)
if git_commit:
log.colored(log.YELLOW, "=== revision: '{}':".format(git_commit))
dep_ok = git.checkout(dep_proj_dir, git_commit)
else:
dep_ok = True
else :
log.colored(log.BLUE, " updating '{}'...".format(dep_proj_dir))
git.update(dep_proj_dir)
if git_commit:
log.colored(log.YELLOW, "=== revision: '{}':".format(git_commit))
dep_ok = git.checkout(dep_proj_dir, git_commit)
else:
dep_ok = True
log.colored(log.BLUE, " '{}' is not a git repository".format(dep_proj_dir))
else :
log.warn(" '{}' does not exist, please run 'fips fetch'".format(dep_proj_dir))
# recuse
Expand Down

0 comments on commit d0194ee

Please sign in to comment.