aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/cmdutil.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2008-11-14 00:10:44 -0500
committerW. Trevor King <wking@drexel.edu>2008-11-14 00:10:44 -0500
commit67127ba95f877071ba2958d507527690ba70b231 (patch)
tree43ce3530f64f19a906d6af96ffa140e082a798d7 /libbe/cmdutil.py
parentae7cf46ed388d22aa380b96e540cafd830395daa (diff)
downloadbugseverywhere-67127ba95f877071ba2958d507527690ba70b231.tar.gz
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).
Diffstat (limited to 'libbe/cmdutil.py')
-rw-r--r--libbe/cmdutil.py9
1 files 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):