From 67127ba95f877071ba2958d507527690ba70b231 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 14 Nov 2008 00:10:44 -0500 Subject: [PATCH] Cleaned up and docstringed libbe.cmdutil.unique_name(). Now the first bug will have a 3 char short name (used to be one char, with the second bug having a 3 char name). --- libbe/cmdutil.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libbe/cmdutil.py b/libbe/cmdutil.py index 079601e..cc2b60f 100644 --- a/libbe/cmdutil.py +++ b/libbe/cmdutil.py @@ -24,14 +24,17 @@ from StringIO import StringIO import utility def unique_name(bug, bugs): - chars = 1 + """ + Generate short names from uuids. Picks the minimum number of + characters (>=3) from the beginning of the uuid such that the + short names are unique. + """ + chars = 3 for some_bug in bugs: if bug.uuid == some_bug.uuid: continue while (bug.uuid[:chars] == some_bug.uuid[:chars]): chars+=1 - if chars < 3: - chars = 3 return bug.uuid[:chars] class UserError(Exception): -- 2.26.2