Skip to content

Commit f68ed84

Browse files
committed
get: print real names in comment headers
Keep track of real names as we parse the bug and reuse the dictionary as we print list of comments. Should work unless somebody has commented and then unsubscribed from Cc, in that case fallback to just email.
1 parent 9d4e70a commit f68ed84

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

bugz/cli.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ def show_bug_info(bug, settings):
269269
'is_creator_accessible', 'is_cc_accessible', 'is_open',
270270
'update_token']
271271
TimeFields = ['last_change_time', 'creation_time']
272+
user_detail = {}
272273

273274
for field in bug:
274275
if field in SkipFields:
@@ -283,9 +284,11 @@ def show_bug_info(bug, settings):
283284
value = bug[field]
284285
if field in ['assigned_to_detail', 'creator_detail']:
285286
print('%-12s: %s <%s>' % (desc, value['real_name'], value['email']))
287+
user_detail[value['email']] = value
286288
elif field == 'cc_detail':
287289
for cc in value:
288290
print('%-12s: %s <%s>' % (desc, cc['real_name'], cc['email']))
291+
user_detail[cc['email']] = cc
289292
elif field == 'see_also':
290293
for x in value:
291294
print('%-12s: %s' % (desc, x))
@@ -319,10 +322,15 @@ def show_bug_info(bug, settings):
319322
break_long_words=False,
320323
break_on_hyphens=False)
321324
for comment in bug_comments:
322-
who = comment['creator']
325+
if comment['creator'] in user_detail:
326+
who = '%s <%s>' % (
327+
user_detail[comment['creator']]['real_name'],
328+
comment['creator'])
329+
else:
330+
who = comment['creator']
323331
when = parsetime(comment['time'])
324332
what = comment['text']
325-
print('[Comment #%d] %s : %s' % (i, who, printtime(when, settings)))
333+
print('[Comment #%d] %s %s' % (i, who, printtime(when, settings)))
326334
print('-' * (settings.columns - 1))
327335

328336
if what is None:

0 commit comments

Comments
 (0)