@@ -155,12 +155,12 @@ def get_commits_between_tags(old_tag, new_tag, cwd=None, author=None):
155155 parts = line .split ('|' , 2 )
156156 if len (parts ) < 3 :
157157 continue
158- full_hash , subject , author = parts
158+ full_hash , subject , author_name = parts # FIX: renamed variable
159159 full_hash = full_hash .strip ()
160160 subject = subject .strip ()
161- author = author .strip ()
161+ author_name = author_name .strip ()
162162
163- mapped_author = map_author (author , author )
163+ mapped_author = map_author (author_name , author ) # use outer 'author' dict
164164 pr_nums = extract_pr_numbers (subject )
165165 clean_msg = clean_subject (subject )
166166 commit_url = f"{ repo_base_url } /commit/{ full_hash } "
@@ -298,6 +298,63 @@ def auto_release_notes(manifest_path, comp_repo_map, image_repo_map, author_file
298298 if curr_yaml is None :
299299 sys .exit (f"Error: Could not read { manifest_path } from current HEAD" )
300300
301+ # ---- list_only mode: exit early without any repo operations ----
302+ if list_only :
303+ # Get previous YAML for comparison
304+ if not force :
305+ prev_yaml = get_yaml_from_commit (manifest_path , "HEAD^" )
306+ if prev_yaml is None :
307+ print ("Warning: No previous version, assuming all components are new" )
308+ prev_comp_versions = {}
309+ prev_yaml_full = None
310+ else :
311+ prev_comp_versions = extract_component_versions (prev_yaml )
312+ prev_yaml_full = prev_yaml
313+ else :
314+ # For --force --list-changed, still compare with HEAD^ (no repo tag lookup)
315+ prev_yaml = get_yaml_from_commit (manifest_path , "HEAD^" )
316+ if prev_yaml is None :
317+ prev_comp_versions = {}
318+ prev_yaml_full = None
319+ else :
320+ prev_comp_versions = extract_component_versions (prev_yaml )
321+ prev_yaml_full = prev_yaml
322+
323+ curr_comp_versions = extract_component_versions (curr_yaml )
324+
325+ changed_names = set ()
326+ # Component changes
327+ for (comp , idx ), new_ver in curr_comp_versions .items ():
328+ old_ver = prev_comp_versions .get ((comp , idx ))
329+ if old_ver is not None and str (old_ver ) != str (new_ver ):
330+ changed_names .add (comp )
331+
332+ # Image changes
333+ for image_name , parent_comp in MONITORED_IMAGES .items ():
334+ curr_ver , _ = extract_image_version (curr_yaml , parent_comp , image_name )
335+ if curr_ver is None :
336+ continue
337+ if prev_yaml_full :
338+ prev_ver , _ = extract_image_version (prev_yaml_full , parent_comp , image_name )
339+ if prev_ver is not None and prev_ver != curr_ver :
340+ short_name = image_name .split ('/' )[- 1 ]
341+ changed_names .add (short_name )
342+ else :
343+ # No previous YAML: assume changed
344+ short_name = image_name .split ('/' )[- 1 ]
345+ changed_names .add (short_name )
346+
347+ # Version follow (no repo required)
348+ VERSION_FOLLOW = {"kubeblocks-console" : "kubeblocks-cloud" }
349+ for child , parent in VERSION_FOLLOW .items ():
350+ if parent in changed_names and child not in changed_names :
351+ changed_names .add (child )
352+
353+ output = '' .join (f'[{ n } ]' for n in sorted (changed_names ))
354+ print (output if output else "No changes" )
355+ return
356+ # ---- end list_only early exit ----
357+
301358 # For normal mode, get previous YAML
302359 if not force :
303360 prev_yaml = get_yaml_from_commit (manifest_path , "HEAD^" )
@@ -307,6 +364,8 @@ def auto_release_notes(manifest_path, comp_repo_map, image_repo_map, author_file
307364 else :
308365 prev_yaml = None
309366
367+ # ... rest of original function unchanged ...
368+
310369 # Collect changes for components
311370 curr_comp_versions = extract_component_versions (curr_yaml )
312371
@@ -423,24 +482,7 @@ def sort_key(entry):
423482 changed_entries .sort (key = sort_key )
424483
425484 # ------------------------------------------------------------
426- # If --list-changed, output compact name list and exit
427- # ------------------------------------------------------------
428- if list_only :
429- names_set = set ()
430- for etype , name , idx , old_tag , new_tag , _ in changed_entries :
431- if etype == 'component' :
432- names_set .add (name ) # component name as-is
433- else : # image
434- short_name = name .split ('/' )[- 1 ] # e.g. dms, oteld
435- names_set .add (short_name )
436- # Sort for deterministic output (optional, but convenient)
437- sorted_names = sorted (names_set )
438- output = '' .join (f'[{ n } ]' for n in sorted_names )
439- print (output if output else "No changes" )
440- return
441-
442- # ------------------------------------------------------------
443- # Otherwise, generate full release notes (original behavior)
485+ # Generate full release notes (original behavior)
444486 # ------------------------------------------------------------
445487 print (f"Found { len (changed_entries )} version change(s):" )
446488 for etype , name , idx , old , new , _ in changed_entries :
0 commit comments