From da5664e08b87e5ff479bd79e72ba9685f9cd7a4d Mon Sep 17 00:00:00 2001 From: Aaron Bentley Date: Sat, 19 Mar 2005 07:53:03 +0000 Subject: [PATCH] Implemented current target setting --- .../values | 2 +- becommands/list.py | 24 +++++++++++++- becommands/set.py | 31 +++++++++++++++++-- libbe/bugdir.py | 2 ++ 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/.be/bugs/9daa72ee-0721-4f68-99ee-f06fec0b340e/values b/.be/bugs/9daa72ee-0721-4f68-99ee-f06fec0b340e/values index b2c2b0a..e6f6827 100644 --- a/.be/bugs/9daa72ee-0721-4f68-99ee-f06fec0b340e/values +++ b/.be/bugs/9daa72ee-0721-4f68-99ee-f06fec0b340e/values @@ -22,7 +22,7 @@ severity=minor -status=open +status=closed diff --git a/becommands/list.py b/becommands/list.py index 0b27a25..d92ebac 100644 --- a/becommands/list.py +++ b/becommands/list.py @@ -4,6 +4,7 @@ import os def execute(args): active = True severity = ("minor", "serious", "critical", "fatal") + tree = cmdutil.bug_tree() def filter(bug): if active is not None: if bug.active != active: @@ -11,16 +12,31 @@ def execute(args): if bug.severity not in severity: return False return True - all_bugs = list(cmdutil.bug_tree().list()) + all_bugs = list(tree.list()) bugs = [b for b in all_bugs if filter(b) ] if len(bugs) == 0: print "No matching bugs found" current_id = names.creator() + my_target_bugs = [] + other_target_bugs = [] + unassigned_target_bugs = [] my_bugs = [] other_bugs = [] unassigned_bugs = [] for bug in bugs: + if tree.target is not None and bug.target != tree.target: + continue + if bug.assigned == current_id: + my_target_bugs.append(bug) + elif bug.assigned is None: + unassigned_target_bugs.append(bug) + else: + other_target_bugs.append(bug) + + for bug in bugs: + if tree.target is not None and bug.target == tree.target: + continue if bug.assigned == current_id: my_bugs.append(bug) elif bug.assigned is None: @@ -35,6 +51,12 @@ def execute(args): for bug in cur_bugs: print cmdutil.bug_summary(bug, all_bugs) + list_bugs(my_target_bugs, + "Bugs assigned to you for target %s" % tree.target) + list_bugs(unassigned_target_bugs, + "Unassigned bugs for target %s" % tree.target) + list_bugs(other_target_bugs, + "Bugs assigned to others for target %s" % tree.target) list_bugs(my_bugs, "Bugs assigned to you") list_bugs(unassigned_bugs, "Unassigned bugs") list_bugs(other_bugs, "Bugs assigned to others") diff --git a/becommands/set.py b/becommands/set.py index 956a95e..547e4a9 100644 --- a/becommands/set.py +++ b/becommands/set.py @@ -1,11 +1,36 @@ """Change tree settings""" from libbe import cmdutil def execute(args): - assert len(args) in (1, 2) + assert len(args) in (0, 1, 2) tree = cmdutil.bug_tree() - if len(args) == 1: + if len(args) == 0: + keys = tree.settings.keys() + keys.sort() + for key in keys: + print "%16s: %s" % (key, tree.settings[key]) + elif len(args) == 1: print tree.settings.get(args[0]) else: - tree.settings[args[0]] = args[1] + if args[1] != "none": + tree.settings[args[0]] = args[1] + else: + del tree.settings[args[0]] tree.save_settings() +def help(): + return """be set [name] [value] + +Show or change per-tree settings. + +If name and value are supplied, the name is set to a new value. +If no value is specified, the current value is printed. +If no arguments are provided, all names and values are listed. + +Interesting settings are: +rcs_name + The name of the revision control system. "Arch" and "None" are supported. +target + The current development goal + +To unset a setting, set it to "none". +""" diff --git a/libbe/bugdir.py b/libbe/bugdir.py index 9084ee8..e2f40d6 100644 --- a/libbe/bugdir.py +++ b/libbe/bugdir.py @@ -83,6 +83,8 @@ class BugDir: rcs_name = setting_property("rcs_name", ("None", "Arch")) _rcs = None + target = setting_property("target") + def save_settings(self): map_save(self.rcs, os.path.join(self.dir, "settings"), self.settings) -- 2.26.2