diff options
author | W. Trevor King <wking@drexel.edu> | 2008-11-16 14:55:55 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2008-11-16 14:55:55 -0500 |
commit | b5959aee578055431eeb80befde7272754b2b8ad (patch) | |
tree | 229cd2895070d61d86a8fe22450dc88063506840 /becommands/remove.py | |
parent | fd4678b2c6c46488b1c0922e4b737ce908e29abd (diff) | |
download | bugseverywhere-b5959aee578055431eeb80befde7272754b2b8ad.tar.gz |
Oops, I'd forgotten to tell bzr about my becommands/remove.py.
Diffstat (limited to 'becommands/remove.py')
-rw-r--r-- | becommands/remove.py | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/becommands/remove.py b/becommands/remove.py new file mode 100644 index 0000000..3834e16 --- /dev/null +++ b/becommands/remove.py @@ -0,0 +1,58 @@ +# Copyright (C) 2005 Aaron Bentley and Panometrics, Inc. +# <abentley@panoramicfeedback.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +"""Remove (delete) a bug and its comments""" +from libbe import cmdutil, names, utility +from libbe.bug import new_bug +__desc__ = __doc__ + +def execute(args): + """ + >>> import os + >>> from libbe import tests, mapfile + >>> dir = tests.simple_bug_dir() + >>> os.chdir(dir.dir) + >>> dir.get_bug("b").status + u'closed' + >>> execute (["b"]) + Removed bug b + >>> try: + ... dir.get_bug("b") + ... except mapfile.NoSuchFile: + ... print "Bug not found" + Bug not found + >>> tests.clean_up() + """ + options, args = get_parser().parse_args(args) + if len(args) != 1: + raise cmdutil.UserError("Please specify a bug id.") + bug = cmdutil.get_bug(args[0]) + bug.remove() + print "Removed bug %s" % bug.uuid + +def get_parser(): + parser = cmdutil.CmdOptionParser("be remove bug-id") + return parser + +longhelp=""" +Remove (delete) an existing bug. Use with caution: if you're not using a +revision control system, there may be no way to recover the lost information. +You should use this command, for example, to get rid of blank or otherwise +mangled bugs. +""" + +def help(): + return get_parser().help_str() + longhelp |