aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/close.py
diff options
context:
space:
mode:
Diffstat (limited to 'becommands/close.py')
-rw-r--r--becommands/close.py34
1 files changed, 20 insertions, 14 deletions
diff --git a/becommands/close.py b/becommands/close.py
index 52ab735..8d2ccdb 100644
--- a/becommands/close.py
+++ b/becommands/close.py
@@ -15,33 +15,39 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Close a bug"""
-from libbe import cmdutil
+from libbe import cmdutil, bugdir
+__desc__ = __doc__
+
def execute(args):
"""
- >>> from libbe import tests
+ >>> from libbe import bugdir
>>> import os
- >>> dir = tests.simple_bug_dir()
- >>> os.chdir(dir.dir)
- >>> dir.get_bug("a").status
- u'open'
+ >>> bd = bugdir.simple_bug_dir()
+ >>> os.chdir(bd.root)
+ >>> print bd.bug_from_shortname("a").status
+ open
>>> execute(["a"])
- >>> dir.get_bug("a").status
- u'closed'
- >>> tests.clean_up()
+ >>> bd._clear_bugs()
+ >>> print bd.bug_from_shortname("a").status
+ closed
"""
options, args = get_parser().parse_args(args)
- if len(args) !=1:
+ if len(args) == 0:
raise cmdutil.UserError("Please specify a bug id.")
- bug = cmdutil.get_bug(args[0])
+ if len(args) > 1:
+ help()
+ raise cmdutil.UserError("Too many arguments.")
+ bd = bugdir.BugDir(from_disk=True)
+ bug = bd.bug_from_shortname(args[0])
bug.status = "closed"
- bug.save()
+ bd.save()
def get_parser():
- parser = cmdutil.CmdOptionParser("be close bug-id")
+ parser = cmdutil.CmdOptionParser("be close BUG-ID")
return parser
longhelp="""
-Close the bug identified by bug-id.
+Close the bug identified by BUG-ID.
"""
def help():