[Concept,3/9] pickman: Group named-tuple declarations together

Message ID 20260212211626.167191-4-sjg@u-boot.org
State New
Headers
Series pickman: Improve handling of large merges and add rewind |

Commit Message

Simon Glass Feb. 12, 2026, 9:16 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Move AgentCommit and ApplyInfo above parse_log_output() so that
all named-tuple declarations are together at the top of the file.

Fill out the comment for ApplyInfo

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 tools/pickman/control.py | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)
  

Patch

diff --git a/tools/pickman/control.py b/tools/pickman/control.py
index 54e1c568d7b..c88fa567191 100644
--- a/tools/pickman/control.py
+++ b/tools/pickman/control.py
@@ -79,6 +79,24 @@  CheckResult = namedtuple('CheckResult', [
 CommitInfo = namedtuple('CommitInfo',
                         ['hash', 'chash', 'subject', 'author'])
 
+# Named tuple for simplified commit data passed to agent
+# hash: Full SHA-1 commit hash (40 characters)
+# chash: Abbreviated commit hash (typically 7-8 characters)
+# subject: First line of commit message (commit subject)
+# applied_as: Short hash if potentially already applied, None otherwise
+AgentCommit = namedtuple('AgentCommit',
+                         ['hash', 'chash', 'subject', 'applied_as'])
+
+# Named tuple for prepare_apply() result
+#
+# commits: list of AgentCommit to cherry-pick
+# branch_name: name of the branch to create for the MR
+# original_branch: branch name before any conflict suffix
+# merge_found: True if these commits came from a merge on the source branch
+ApplyInfo = namedtuple('ApplyInfo',
+                       ['commits', 'branch_name', 'original_branch',
+                        'merge_found'])
+
 
 def parse_log_output(log_output, has_parents=False):
     """Parse git log output to extract CommitInfo tuples
@@ -107,19 +125,6 @@  def parse_log_output(log_output, has_parents=False):
         commits.append(CommitInfo(commit_hash, chash, subject, author))
     return commits
 
-# Named tuple for simplified commit data passed to agent
-# hash: Full SHA-1 commit hash (40 characters)
-# chash: Abbreviated commit hash (typically 7-8 characters)
-# subject: First line of commit message (commit subject)
-# applied_as: Short hash if potentially already applied, None otherwise
-AgentCommit = namedtuple('AgentCommit',
-                         ['hash', 'chash', 'subject', 'applied_as'])
-
-# Named tuple for prepare_apply result
-ApplyInfo = namedtuple('ApplyInfo',
-                       ['commits', 'branch_name', 'original_branch',
-                        'merge_found'])
-
 
 def run_git(args):
     """Run a git command and return output."""