Skip to content

Commit

Permalink
simpler solution
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Sep 17, 2020
1 parent 5b5e1c2 commit dc67cc6
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions manic/sourcetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,13 @@ def checkout(self, verbosity, load_all, load_comp=None):
printlog('Checking out externals: ', end='')

if load_all:
load_comps = self._all_components.keys()
tmp_comps = self._all_components.keys()
elif load_comp is not None:
load_comps = [load_comp]
tmp_comps = [load_comp]
else:
load_comps = self._required_compnames
tmp_comps = self._required_compnames

load_comps = self.order_comps_by_local_path(self, tmp_comps)

# checkout the primary externals
for comp in load_comps:
Expand All @@ -351,3 +353,20 @@ def checkout(self, verbosity, load_all, load_comp=None):
# now give each external an opportunitity to checkout it's externals.
for comp in load_comps:
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())
local_paths = list(set(local_paths))
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)
comps_out = list(set(comps_out))
return comps_out

0 comments on commit dc67cc6

Please sign in to comment.