diff options
author | W. Trevor King <wking@drexel.edu> | 2008-11-27 19:35:55 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2008-11-27 19:35:55 -0500 |
commit | 01bf5c7970b3d7cb872902f5a5298b489da3defb (patch) | |
tree | a049d9f90e1e4b3e511b73a5a40e5bdd81e76a8d /becommands | |
parent | 7a67efb3bc61ec499c9af7de7c54a7b98db7eafd (diff) | |
download | bugseverywhere-01bf5c7970b3d7cb872902f5a5298b489da3defb.tar.gz |
Optimized bug loading from becommands/comment with partial-uuid matching.
The code is a bit uglier now, but it's a good deal faster :).
Diffstat (limited to 'becommands')
-rw-r--r-- | becommands/comment.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/becommands/comment.py b/becommands/comment.py index 8fdbe42..5000588 100644 --- a/becommands/comment.py +++ b/becommands/comment.py @@ -122,12 +122,20 @@ def complete(options, args, parser): for pos,value in enumerate(args): if value == "--complete": if pos == 0: # fist positional argument is a bug or comment id + if len(args) >= 2: + partial = args[1].split(':')[0] # take only bugid portion + else: + partial = "" ids = [] try: bd = bugdir.BugDir(from_disk=True, manipulate_encodings=False) - bd.load_all_bugs() - bugs = [bug for bug in bd if bug.active == True] + bugs = [] + for uuid in bd.list_uuids(): + if uuid.startswith(partial): + bug = bd.bug_from_uuid(uuid) + if bug.active == True: + bugs.append(bug) for bug in bugs: shortname = bd.bug_shortname(bug) ids.append(shortname) |