aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/new.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2008-11-24 18:29:16 -0500
committerW. Trevor King <wking@drexel.edu>2008-11-24 18:29:16 -0500
commita711ecf10df62e30d83c1941065404c53fecd35b (patch)
tree4111ef606fa52dc7f21ca3eb357ff83fae74fe1e /becommands/new.py
parentc5d7551e6a6e98bb6da7c7d11360224edfda2f14 (diff)
parent2c3f6c066ceb03ae3579dff029bf01f0b62c1f82 (diff)
downloadbugseverywhere-a711ecf10df62e30d83c1941065404c53fecd35b.tar.gz
Merge from W. Trevor King's tree.
Diffstat (limited to 'becommands/new.py')
-rw-r--r--becommands/new.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/becommands/new.py b/becommands/new.py
index 7bd2382..caa1549 100644
--- a/becommands/new.py
+++ b/becommands/new.py
@@ -15,37 +15,36 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Create a new bug"""
-from libbe import bugdir, cmdutil, names, utility
+from libbe import cmdutil, bugdir
+__desc__ = __doc__
+
def execute(args):
"""
>>> import os, time
- >>> from libbe import tests
- >>> dir = tests.bug_arch_dir()
- >>> os.chdir(dir.dir)
- >>> names.uuid = lambda: "a"
+ >>> from libbe import bug
+ >>> bd = bugdir.simple_bug_dir()
+ >>> os.chdir(bd.root)
+ >>> bug.uuid_gen = lambda: "X"
>>> execute (["this is a test",])
- Created bug with ID a
- >>> bug = list(dir.list())[0]
+ Created bug with ID X
+ >>> bd.load()
+ >>> bug = bd.bug_from_uuid("X")
>>> bug.summary
u'this is a test'
- >>> bug.creator = os.environ["LOGNAME"]
>>> bug.time <= int(time.time())
True
>>> bug.severity
u'minor'
>>> bug.target == None
True
- >>> tests.clean_up()
"""
options, args = get_parser().parse_args(args)
if len(args) != 1:
raise cmdutil.UserError("Please supply a summary message")
- dir = cmdutil.bug_tree()
- bug = bugdir.new_bug(dir)
- bug.summary = args[0]
- bug.save()
- bugs = (dir.list())
- print "Created bug with ID %s" % cmdutil.unique_name(bug, bugs)
+ bd = bugdir.BugDir(from_disk=True)
+ bug = bd.new_bug(summary=args[0])
+ bd.save()
+ print "Created bug with ID %s" % bd.bug_shortname(bug)
def get_parser():
parser = cmdutil.CmdOptionParser("be new SUMMARY")