Skip to content

Commit

Permalink
improve sorting, checkout externals with each comp
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Sep 18, 2020
1 parent 29f45b0 commit 24a3726
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions manic/sourcetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,9 @@ def checkout(self, verbosity, load_all, load_comp=None):
tmp_comps = [load_comp]
else:
tmp_comps = self._required_compnames

load_comps = self.order_comps_by_local_path(tmp_comps)
# Sort by path so that if paths are nested the
# parent repo is checked out first.
load_comps = sorted(tmp_comps,key=lambda comp: self._all_components[comp].get_local_path())
# checkout the primary externals
for comp in load_comps:
if verbosity < VERBOSITY_VERBOSE:
Expand All @@ -347,23 +348,6 @@ def checkout(self, verbosity, load_all, load_comp=None):
# output a newline
printlog(EMPTY_STR)
self._all_components[comp].checkout(verbosity, load_all)
printlog('')

# now give each external an opportunitity to checkout it's externals.
for comp in load_comps:
# now give each external an opportunitity to checkout it's externals.
self._all_components[comp].checkout_externals(verbosity, load_all)

def order_comps_by_local_path(self, comps_in):
"""
put the comps into an order so that comp local_paths
that are nested are checked out in correct order
"""
comps_out = []
local_paths = []
for comp in comps_in:
local_paths.append(self._all_components[comp].get_local_path())
for path in sorted(local_paths, key=len):
for comp in comps_in:
if self._all_components[comp].get_local_path() == path:
comps_out.append(comp)
return comps_out
printlog('')

0 comments on commit 24a3726

Please sign in to comment.