aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/new.py
diff options
context:
space:
mode:
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")