From: W. Trevor King Date: Wed, 29 Jul 2009 19:56:10 +0000 (-0400) Subject: Merged interactive email interface X-Git-Tag: 1.0.0~62^2~46 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dcfe9d5e292fa4a405fafb4bdd6d9e2070f30fa9;p=be.git Merged interactive email interface --- dcfe9d5e292fa4a405fafb4bdd6d9e2070f30fa9 diff --cc becommands/assign.py index 81aac2b,ba79aac..7b32bdd --- a/becommands/assign.py +++ b/becommands/assign.py @@@ -53,8 -53,9 +53,10 @@@ def execute(args, manipulate_encodings= if len(args) > 2: help() raise cmdutil.UsageError("Too many arguments.") - bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) + bd = bugdir.BugDir(from_disk=True, + manipulate_encodings=manipulate_encodings) + bug = cmdutil.bug_from_shortname(bd, args[0]) + bug = bd.bug_from_shortname(args[0]) if len(args) == 1: bug.assigned = bd.user_id elif len(args) == 2: diff --cc becommands/close.py index 327817a,05bdc10..12848b2 --- a/becommands/close.py +++ b/becommands/close.py @@@ -41,8 -41,9 +41,9 @@@ def execute(args, manipulate_encodings= raise cmdutil.UsageError("Please specify a bug id.") if len(args) > 1: raise cmdutil.UsageError("Too many arguments.") - bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) + bd = bugdir.BugDir(from_disk=True, + manipulate_encodings=manipulate_encodings) - bug = bd.bug_from_shortname(args[0]) + bug = cmdutil.bug_from_shortname(bd, args[0]) bug.status = "closed" bd.save() diff --cc becommands/comment.py index 4221ef8,7bbee2c..14872a3 --- a/becommands/comment.py +++ b/becommands/comment.py @@@ -30,9 -30,9 +30,9 @@@ def execute(args, manipulate_encodings= >>> import time >>> bd = bugdir.simple_bug_dir() >>> os.chdir(bd.root) - >>> execute(["a", "This is a comment about a"], test=True) + >>> execute(["a", "This is a comment about a"], manipulate_encodings=False) >>> bd._clear_bugs() - >>> bug = bd.bug_from_shortname("a") + >>> bug = cmdutil.bug_from_shortname(bd, "a") >>> bug.load_comments(load_full=False) >>> comment = bug.comment_root[0] >>> print comment.body @@@ -52,9 -52,9 +52,9 @@@ UserError: No comment supplied, and EDITOR not specified. >>> os.environ["EDITOR"] = "echo 'I like cheese' > " - >>> execute(["b"], test=True) + >>> execute(["b"], manipulate_encodings=False) >>> bd._clear_bugs() - >>> bug = bd.bug_from_shortname("b") + >>> bug = cmdutil.bug_from_shortname(bd, "b") >>> bug.load_comments(load_full=False) >>> comment = bug.comment_root[0] >>> print comment.body @@@ -79,10 -79,10 +79,10 @@@ else: bugname = shortname is_reply = False - + bd = bugdir.BugDir(from_disk=True, - manipulate_encodings=not test) + manipulate_encodings=manipulate_encodings) - bug = bd.bug_from_shortname(bugname) + bug = cmdutil.bug_from_shortname(bd, bugname) bug.load_comments(load_full=False) if is_reply: parent = bug.comment_root.comment_from_shortname(shortname, diff --cc becommands/depend.py index d22ed2d,201c2ea..fd38bd1 --- a/becommands/depend.py +++ b/becommands/depend.py @@@ -47,10 -47,11 +47,11 @@@ def execute(args, manipulate_encodings= help() raise cmdutil.UsageError("Too many arguments.") - bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) + bd = bugdir.BugDir(from_disk=True, + manipulate_encodings=manipulate_encodings) - bugA = bd.bug_from_shortname(args[0]) + bugA = cmdutil.bug_from_shortname(bd, args[0]) if len(args) == 2: - bugB = bd.bug_from_shortname(args[1]) + bugB = cmdutil.bug_from_shortname(bd, args[1]) estrs = bugA.extra_strings depend_string = "BLOCKED-BY:%s" % bugB.uuid if options.remove == True: diff --cc becommands/merge.py index 633067c,8e1fd50..6651869 --- a/becommands/merge.py +++ b/becommands/merge.py @@@ -133,10 -133,11 +133,11 @@@ def execute(args, manipulate_encodings= help() raise cmdutil.UsageError("Too many arguments.") - bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) + bd = bugdir.BugDir(from_disk=True, + manipulate_encodings=manipulate_encodings) - bugA = bd.bug_from_shortname(args[0]) + bugA = cmdutil.bug_from_shortname(bd, args[0]) bugA.load_comments() - bugB = bd.bug_from_shortname(args[1]) + bugB = cmdutil.bug_from_shortname(bd, args[1]) bugB.load_comments() mergeA = bugA.new_comment("Merged from bug %s" % bugB.uuid) newCommTree = copy.deepcopy(bugB.comment_root) diff --cc becommands/open.py index 242ceb2,b98463d..bfb54ea --- a/becommands/open.py +++ b/becommands/open.py @@@ -40,8 -40,9 +40,9 @@@ def execute(args, manipulate_encodings= raise cmdutil.UsageError, "Please specify a bug id." if len(args) > 1: raise cmdutil.UsageError, "Too many arguments." - bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) + bd = bugdir.BugDir(from_disk=True, + manipulate_encodings=manipulate_encodings) - bug = bd.bug_from_shortname(args[0]) + bug = cmdutil.bug_from_shortname(bd, args[0]) bug.status = "open" def get_parser(): diff --cc becommands/remove.py index 7193119,884b792..bc7b5ed --- a/becommands/remove.py +++ b/becommands/remove.py @@@ -40,8 -40,9 +40,9 @@@ def execute(args, manipulate_encodings= bugid_args={0: lambda bug : bug.active==True}) if len(args) != 1: raise cmdutil.UsageError, "Please specify a bug id." - bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) + bd = bugdir.BugDir(from_disk=True, + manipulate_encodings=manipulate_encodings) - bug = bd.bug_from_shortname(args[0]) + bug = cmdutil.bug_from_shortname(bd, args[0]) bd.remove_bug(bug) print "Removed bug %s" % bug.uuid diff --cc becommands/severity.py index 74f241d,d125789..a14a96b --- a/becommands/severity.py +++ b/becommands/severity.py @@@ -39,8 -39,9 +39,9 @@@ def execute(args, manipulate_encodings= complete(options, args, parser) if len(args) not in (1,2): raise cmdutil.UsageError - bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) + bd = bugdir.BugDir(from_disk=True, + manipulate_encodings=manipulate_encodings) - bug = bd.bug_from_shortname(args[0]) + bug = cmdutil.bug_from_shortname(bd, args[0]) if len(args) == 1: print bug.severity elif len(args) == 2: diff --cc becommands/status.py index bff0626,56cb505..e4db787 --- a/becommands/status.py +++ b/becommands/status.py @@@ -36,8 -36,9 +36,9 @@@ def execute(args, manipulate_encodings= complete(options, args, parser) if len(args) not in (1,2): raise cmdutil.UsageError - bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) + bd = bugdir.BugDir(from_disk=True, + manipulate_encodings=manipulate_encodings) - bug = bd.bug_from_shortname(args[0]) + bug = cmdutil.bug_from_shortname(bd, args[0]) if len(args) == 1: print bug.status else: diff --cc libbe/bugdir.py index f7345fd,e9854c9..1bb307c --- a/libbe/bugdir.py +++ b/libbe/bugdir.py @@@ -62,12 -63,11 +63,17 @@@ class MultipleBugMatches(ValueError) self.shortname = shortname self.matches = matches +class NoBugMatches(KeyError): + def __init__(self, shortname): + msg = "No bug matches %s" % shortname + KeyError.__init__(self, msg) + self.shortname = shortname + + class DiskAccessRequired (Exception): + def __init__(self, goal): + msg = "Cannot %s without accessing the disk" % goal + Exception.__init__(self, msg) + TREE_VERSION_STRING = "Bugs Everywhere Tree 1 0\n" diff --cc libbe/rcs.py index 294b8e0,fdbb01a..0206bf6 --- a/libbe/rcs.py +++ b/libbe/rcs.py @@@ -405,16 -413,22 +415,28 @@@ class RCS(object) finally: os.remove(filename) return revision - def precommit(self, directory): + def precommit(self): + """ + Executed before all attempted commits. + """ pass - def postcommit(self, directory): + def postcommit(self): + """ + Only executed after successful commits. + """ pass + def revision_id(self, index=None): + """ + Return the name of the th revision. The choice of + which branch to follow when crossing branches/merges is not + defined. + + Return None if index==None, revision IDs are not supported, or + if the specified revision does not exist. + """ + if index == None: + return None + return self._rcs_revision_id(index) def _u_any_in_string(self, list, string): """ Return True if any of the strings in list are in string.