aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/new.py
diff options
context:
space:
mode:
Diffstat (limited to 'becommands/new.py')
-rw-r--r--becommands/new.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/becommands/new.py b/becommands/new.py
index 0f9928a..c9688b9 100644
--- a/becommands/new.py
+++ b/becommands/new.py
@@ -15,22 +15,22 @@
# 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 cmdutil, names
+from libbe import cmdutil, bugdir
__desc__ = __doc__
def execute(args):
"""
>>> import os, time
- >>> from libbe import bugdir
- >>> dir = bugdir.simple_bug_dir()
- >>> os.chdir(dir.dir)
- >>> names.uuid = lambda: "X"
+ >>> 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 X
- >>> bug = cmdutil.get_bug("X", dir)
+ >>> 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
@@ -41,12 +41,10 @@ def execute(args):
options, args = get_parser().parse_args(args)
if len(args) != 1:
raise cmdutil.UserError("Please supply a summary message")
- dir = cmdutil.bug_tree()
- bug = dir.new_bug()
- bug.summary = args[0]
- bug.save()
- bugs = (dir.list())
- print "Created bug with ID %s" % names.unique_name(bug, bugs)
+ bd = bugdir.BugDir(loadNow=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")