diff options
author | W. Trevor King <wking@drexel.edu> | 2008-11-21 14:56:05 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2008-11-21 14:56:05 -0500 |
commit | 23179f50092d91dbeab97ad2b88cdaadb79b615f (patch) | |
tree | 4a5579d686c573d6d438214aa0d2100f01083bef /becommands/list.py | |
parent | a2bdbab9ccd9ca24ce470d2beeea86afb7ede2ae (diff) | |
download | bugseverywhere-23179f50092d91dbeab97ad2b88cdaadb79b615f.tar.gz |
Another major rewrite. Now BugDir, Bug, and Comment are more distinct.
I pushed a lot of the little helper functions into the main classes,
which makes it easier for me to keep track of what's going on. I'm
now at the point where I can run through `python test.py` with each of
the backends (by changing the search order in rcs.py
_get_matching_rcs) without any unexpected errors for each backend
(except Arch). I can also run `test_usage.sh` without non-Arch errors
either.
However, don't consider this a stable commit yet. The bzr backend is
*really*slow*, and the other's aren't blazingly fast either. I think
I'm rewriting the entire database every time I save it :p. Still, it
passes the checks. and I don't like it when zounds of changes build up.
Diffstat (limited to 'becommands/list.py')
-rw-r--r-- | becommands/list.py | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/becommands/list.py b/becommands/list.py index d43b573..22d73d9 100644 --- a/becommands/list.py +++ b/becommands/list.py @@ -15,17 +15,28 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """List bugs""" -from libbe import cmdutil +from libbe import cmdutil, bugdir from libbe.bug import cmp_full, severity_values, status_values, \ active_status_values, inactive_status_values import os __desc__ = __doc__ def execute(args): + """ + >>> import os + >>> bd = bugdir.simple_bug_dir() + >>> os.chdir(bd.root) + >>> execute([]) + a:om: Bug A + >>> execute(["--status", "all"]) + a:om: Bug A + b:cm: Bug B + """ options, args = get_parser().parse_args(args) if len(args) > 0: - raise cmdutil.UsageError - tree = cmdutil.bug_tree() + help() + raise cmdutil.UserError("Too many arguments.") + bd = bugdir.BugDir(loadNow=True) # select status if options.status != None: if options.status == "all": @@ -73,7 +84,7 @@ def execute(args): assigned = "all" for i in range(len(assigned)): if assigned[i] == '-': - assigned[i] = tree.rcs.get_user_id() + assigned[i] = bd.rcs.get_user_id() # select target if options.target != None: if options.target == "all": @@ -83,7 +94,7 @@ def execute(args): else: target = [] if options.cur_target == True: - target.append(tree.target) + target.append(bd.target) if target == []: # set the default value target = "all" @@ -98,8 +109,7 @@ def execute(args): return False return True - all_bugs = list(tree.list()) - bugs = [b for b in all_bugs if filter(b) ] + bugs = [b for b in bd if filter(b) ] if len(bugs) == 0: print "No matching bugs found" @@ -109,7 +119,7 @@ def execute(args): if title != None: print cmdutil.underlined(title) for bug in cur_bugs: - print bug.string(all_bugs, shortlist=True) + print bug.string(shortlist=True) list_bugs(bugs, no_target=False) |