From 19fe0817ba7c2cd04caea3adfa82d4490288a548 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 14 Dec 2009 07:37:51 -0500 Subject: [PATCH] Transitioned comment to Command format --- README.dev | 6 + libbe/bug.py | 8 +- libbe/command/assign.py | 11 +- libbe/command/base.py | 105 ++++++++++++++---- libbe/command/comment.py | 205 ++++++++++++++++------------------- libbe/command/commit.py | 134 +++++++++++++---------- libbe/command/html.py | 12 +- libbe/command/init.py | 8 +- libbe/command/util.py | 18 +++ libbe/comment.py | 18 +-- libbe/storage/util/config.py | 8 +- libbe/storage/vcs/base.py | 7 +- libbe/ui/command_line.py | 38 +++++-- libbe/ui/util/editor.py | 11 +- libbe/util/encoding.py | 22 ++++ 15 files changed, 356 insertions(+), 255 deletions(-) diff --git a/README.dev b/README.dev index dbb97b0..2a09463 100644 --- a/README.dev +++ b/README.dev @@ -88,3 +88,9 @@ execution + childrens' times). $ python -m cProfile -o profile be [command] [args] $ python -c "import pstats; p=pstats.Stats('profile'); p.sort_stats('cumulative').print_stats(20)" + +It's often useful to toss a + import sys, traceback + print >> sys.stderr, '-'*60, '\n', '\n'.join(traceback.format_stack()[-10:]) +into expensive functions (e.g. libbe.util.subproc.invoke()), if you're +not sure why they're being called. diff --git a/libbe/bug.py b/libbe/bug.py index 29d95f5..6c5f958 100644 --- a/libbe/bug.py +++ b/libbe/bug.py @@ -175,14 +175,8 @@ class Bug(settings_object.SavedSettingsObject): def active(self): return self.status in active_status_values - def _get_user_id(self): - if self.bugdir != None: - return self.bugdir._get_user_id() - return None - @_versioned_property(name="creator", - doc="The user who entered the bug into the system", - generator=_get_user_id) + doc="The user who entered the bug into the system") def creator(): return {} @_versioned_property(name="reporter", diff --git a/libbe/command/assign.py b/libbe/command/assign.py index 6d1233c..f5d2df4 100644 --- a/libbe/command/assign.py +++ b/libbe/command/assign.py @@ -75,15 +75,8 @@ class Assign (libbe.command.Command): elif assignee == '-': assignee = params['user-id'] for bug_id in params['bug-id']: - p = libbe.util.id.parse_user(bugdir, bug_id) - if p['type'] != 'bug': - raise libbe.command.UserError( - '%s is a %s id, not a bug id' % (bug_id, p['type'])) - if p['bugdir'] != bugdir.uuid: - raise libbe.command.UserError( - "%s doesn't belong to this bugdir (%s)" - % (bug_id, bugdir.uuid)) - bug = bugdir.bug_from_uuid(p['bug']) + bug,dummy_comment = \ + libbe.command.util.bug_comment_from_user_id(bugdir, bug_id) if bug.assigned != assignee: bug.assigned = assignee diff --git a/libbe/command/base.py b/libbe/command/base.py index b27e188..e28cf33 100644 --- a/libbe/command/base.py +++ b/libbe/command/base.py @@ -2,6 +2,7 @@ import codecs import optparse +import os.path import sys import libbe @@ -9,7 +10,6 @@ import libbe.ui.util.user import libbe.util.encoding import libbe.util.plugin - class UserError(Exception): pass @@ -90,34 +90,55 @@ class Option (CommandInput): def __repr__(self): return '