Skip to content

Commit

Permalink
app: project: Allow updating only cloned projects
Browse files Browse the repository at this point in the history
Add an update command argument and configuration option to allow
updating the currently cloned projects.

This can help in the scenario where a user updated an initial set of
projects manually and would like to only update those in the future.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
  • Loading branch information
pdgendt committed Feb 6, 2025
1 parent b75b86b commit 49d4ccc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/west/app/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,9 @@ def do_add_parser(self, parser_adder):
parser.add_argument('--stats', action='store_true',
help='''print performance statistics for
update operations''')
parser.add_argument('--cloned', action='store_true',
help='''update the projects that are already cloned
in the current workspace''')

group = parser.add_argument_group(
title='local project clone caches',
Expand Down Expand Up @@ -1048,6 +1051,7 @@ def init_state(self, args):
self.name_cache = args.name_cache or config.get('update.name-cache')
self.sync_submodules = config.getboolean('update.sync-submodules',
default=True)
self.cloned = args.cloned or config.getboolean('update.cloned')

self.group_filter: List[str] = []

Expand Down Expand Up @@ -1092,6 +1096,9 @@ def update_all(self):
project.name in self.updated):
continue
try:
if self.cloned and not project.is_cloned():
self.dbg(f'{project.name}: skipping missing project')
continue
if not self.project_is_active(project):
self.dbg(f'{project.name}: skipping inactive project')
continue
Expand Down Expand Up @@ -1162,6 +1169,9 @@ def update_some(self):
for project in projects:
if isinstance(project, ManifestProject):
continue
if self.cloned and not project.is_cloned():
self.dbg(f'{project.name}: skipping missing project')
continue
try:
self.update(project)
except subprocess.CalledProcessError:
Expand Down

0 comments on commit 49d4ccc

Please sign in to comment.