Skip to content

Commit

Permalink
Fix 'resolved' command to skip subdirectories in package checkouts
Browse files Browse the repository at this point in the history
Fixes running 'osc resolved *' in a package checkout with a
subdirectory.
  • Loading branch information
dmach committed Sep 17, 2024
1 parent 1951bb4 commit a142856
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -5990,7 +5990,7 @@ def do_resolved(self, subcmd, opts, *args):
self.argparse_error("Incorrect number of arguments.")

args = parseargs(args)
pacs = Package.from_paths(args)
pacs = Package.from_paths(args, skip_dirs=True)

for p in pacs:
for filename in p.todo:
Expand Down
10 changes: 8 additions & 2 deletions osc/obs_scm/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,15 @@ def __lt__(self, other):
return (self.name, self.prjname, self.apiurl) < (other.name, other.prjname, other.apiurl)

@classmethod
def from_paths(cls, paths, progress_obj=None):
def from_paths(cls, paths, progress_obj=None, *, skip_dirs=False):
"""
Return a list of Package objects from working copies in given paths.
"""
packages = []
for path in paths:
if skip_dirs and os.path.isdir(path):
continue

package = cls(path, progress_obj)
seen_package = None
try:
Expand All @@ -116,14 +119,17 @@ def from_paths(cls, paths, progress_obj=None):
return packages

@classmethod
def from_paths_nofail(cls, paths, progress_obj=None):
def from_paths_nofail(cls, paths, progress_obj=None, *, skip_dirs=False):
"""
Return a list of Package objects from working copies in given paths
and a list of strings with paths that do not contain Package working copies.
"""
packages = []
failed_to_load = []
for path in paths:
if skip_dirs and os.path.isdir(path):
continue

try:
package = cls(path, progress_obj)
except oscerr.NoWorkingCopy:
Expand Down

0 comments on commit a142856

Please sign in to comment.