From 062282bfe91d31ed8b93db0bef4616f3dc37d142 Mon Sep 17 00:00:00 2001 From: Shubham Shukla Date: Sun, 23 Nov 2025 21:16:54 +0530 Subject: [PATCH] Fix small issues across Python tools to improve robustness without changing outputs - reports.py: fix NameError in ReportByReports (use `reported` instead of undefined `report`). - gitdm.py: pass default date range to LogPatchSplitter to match current API and avoid TypeError. - database.py: include `source` column for alias rows in AllAffsCSV to keep CSV shape consistent. - committags.py: write pickle in binary mode (wb) for compatibility. - linetags.py: read pickle in binary mode (rb) for compatibility. - cncfdm.py: avoid unconditional pdb on missing affiliation; only break into debugger with -X, otherwise log and continue. These are no-op for normal outputs except: AllAffsCSV alias rows now include the `source` column as intended. Signed-off-by: Shubham Shukla --- src/cncfdm.py | 9 +++++---- src/committags.py | 2 +- src/database.py | 2 +- src/gitdm.py | 3 ++- src/linetags.py | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/cncfdm.py b/src/cncfdm.py index 4b0587a9..2fcc5d14 100755 --- a/src/cncfdm.py +++ b/src/cncfdm.py @@ -688,10 +688,11 @@ def is_svntag(logpatch): AddDateLines (pa.date, max (pa.added, pa.removed)) empl = pa.author.emailemployer (pa.email, pa.date) if not empl: - # Usually missing the final affiliation (like last affiliation ws untin 2019-01-01 and this patch is from 2019-03-03 - print 'pdb on email ', pa.email - print 'pdb on logpatch ', logpatch - pdb.set_trace() + # Usually missing the final affiliation (like last affiliation was until some date and this patch is after that) + if DebugHalt: + pdb.set_trace() + else: + sys.stderr.write('Missing affiliation for %s at %s; skipping.\n' % (pa.email, pa.date)) continue empl.AddCSet (pa) for sobemail, sobber in pa.sobs: diff --git a/src/committags.py b/src/committags.py index 67f1fc99..e64cb61a 100755 --- a/src/committags.py +++ b/src/committags.py @@ -43,6 +43,6 @@ DB[m.group(1)] = Tag print 'Found %d commits, %d tags' % (len(DB.keys()), Tags) -out = open('committags.db', 'w') +out = open('committags.db', 'wb') pickle.dump(DB, out) out.close() diff --git a/src/database.py b/src/database.py index f2ee4e0c..b9e751a5 100755 --- a/src/database.py +++ b/src/database.py @@ -188,7 +188,7 @@ def AllAffsCSV(file, hlist): if em in emails: print 'This is bad, reverse email already in emails, check: `em`, `email`, `emails`' pdb.set_trace() - writer.writerow ([email_encode(em), email_encode(name), emplstr, datestr]) + writer.writerow ([email_encode(em), email_encode(name), emplstr, datestr, source]) def AllHackers (): return HackersByID.values () diff --git a/src/gitdm.py b/src/gitdm.py index c772b656..4c0292bb 100755 --- a/src/gitdm.py +++ b/src/gitdm.py @@ -413,7 +413,8 @@ def TrimLTSOBs (p): # print >> sys.stderr, 'Grabbing changesets...\r', -patches = logparser.LogPatchSplitter(sys.stdin) +# Default to a wide-open date range to match cncfdm.py +patches = logparser.LogPatchSplitter(sys.stdin, datetime.datetime(1970, 1, 1), datetime.datetime(2069, 1, 1)) printcount = CSCount = 0 for logpatch in patches: diff --git a/src/linetags.py b/src/linetags.py index 2051b571..f5fa2bde 100755 --- a/src/linetags.py +++ b/src/linetags.py @@ -66,7 +66,7 @@ def MapCommits(): # # Grab the tags/version database. # -dbf = open('committags.db', 'r') +dbf = open('committags.db', 'rb') DB = pickle.load(dbf) dbf.close()