aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/target.py
diff options
context:
space:
mode:
Diffstat (limited to 'becommands/target.py')
-rw-r--r--becommands/target.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/becommands/target.py b/becommands/target.py
index 4b015b4..dce100f 100644
--- a/becommands/target.py
+++ b/becommands/target.py
@@ -15,16 +15,14 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Show or change a bug's target for fixing"""
-from libbe import bugdir
-from libbe import cmdutil
+from libbe import cmdutil, bugdir
__desc__ = __doc__
def execute(args):
"""
- >>> from libbe import tests
>>> import os
- >>> dir = tests.simple_bug_dir()
- >>> os.chdir(dir.dir)
+ >>> bd = bugdir.simple_bug_dir()
+ >>> os.chdir(bd.root)
>>> execute(["a"])
No target assigned.
>>> execute(["a", "tomorrow"])
@@ -33,14 +31,14 @@ def execute(args):
>>> execute(["a", "none"])
>>> execute(["a"])
No target assigned.
- >>> tests.clean_up()
"""
options, args = get_parser().parse_args(args)
assert(len(args) in (0, 1, 2))
if len(args) == 0:
print help()
return
- bug = cmdutil.get_bug(args[0])
+ bd = bugdir.BugDir(from_disk=True)
+ bug = bd.bug_from_shortname(args[0])
if len(args) == 1:
if bug.target is None:
print "No target assigned."
@@ -51,16 +49,16 @@ def execute(args):
bug.target = None
else:
bug.target = args[1]
- bug.save()
+ bd.save()
def get_parser():
- parser = cmdutil.CmdOptionParser("be target bug-id [target]")
+ parser = cmdutil.CmdOptionParser("be target BUG-ID [TARGET]")
return parser
longhelp="""
Show or change a bug's target for fixing.
-If no target is specified, the current value is printed. If a target
+If no target is specified, the current value is printed. If a target
is specified, it will be assigned to the bug.
Targets are freeform; any text may be specified. They will generally be