From 4c6a1e6439293c7e584aef4fda0da1a3968fe7c9 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 19 Nov 2009 17:00:02 -0500 Subject: Ran the new update_copyright.py --- becommands/remove.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'becommands/remove.py') diff --git a/becommands/remove.py b/becommands/remove.py index 8d85033..0e61362 100644 --- a/becommands/remove.py +++ b/becommands/remove.py @@ -1,4 +1,5 @@ -# Copyright (C) 2008-2009 W. Trevor King +# Copyright (C) 2008-2009 Gianluca Montecchi +# W. Trevor King # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -- cgit From 3b168403ff5e50d767476c4c0f037d1841bb2bf9 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 21 Nov 2009 10:53:04 -0500 Subject: Broke `be comment --xml` out and extended into `be import-xml`. It should currently do everything that `be comment --xml` did, but it still has a way to go before it lives up to it's longhelp string, mostly figuring out bug/comment merging. The allowed XML format also changed a bit, becoming a bit more structured. cmdutil.bug_from_shortname() renamed to cmdutil.bug_from_id(). New functions cmdutil.parse_id() and cmdutil.bug_comment_from_id(). Additional doctests in libbe.comment.Comment.comment_shortnames() to show example output if bug_shortname==None. Brought be-xml-to-mbox and be-mbox-to-xml up to speed on the current -rooted format. * Added handling to their comment handling. * Moved extra strings from email bodies to X-Extra-String headers (some comment bodies are not text, and we should keep the estr location consistent between bugs and comments.) --- becommands/remove.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'becommands/remove.py') diff --git a/becommands/remove.py b/becommands/remove.py index 0e61362..d265e5c 100644 --- a/becommands/remove.py +++ b/becommands/remove.py @@ -44,7 +44,7 @@ def execute(args, manipulate_encodings=True): raise cmdutil.UsageError, "Please specify a bug id." bd = bugdir.BugDir(from_disk=True, manipulate_encodings=manipulate_encodings) - bug = cmdutil.bug_from_shortname(bd, args[0]) + bug = cmdutil.bug_from_id(bd, args[0]) bd.remove_bug(bug) print "Removed bug %s" % bug.uuid -- cgit From 614d4e40e148520ac511cbe0606bcbdcf24c8a08 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 21 Nov 2009 15:18:02 -0500 Subject: Added restrict_file_access to becommands' execute() args. + associated adjustments in other files. See cmdutil.restrict_file_access.__doc__ for an explanation of the security hole this closes. --- becommands/remove.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'becommands/remove.py') diff --git a/becommands/remove.py b/becommands/remove.py index d265e5c..e4f0065 100644 --- a/becommands/remove.py +++ b/becommands/remove.py @@ -18,7 +18,7 @@ from libbe import cmdutil, bugdir __desc__ = __doc__ -def execute(args, manipulate_encodings=True): +def execute(args, manipulate_encodings=True, restrict_file_access=False): """ >>> from libbe import mapfile >>> import os -- cgit From fdf9925ffaada614544d1b2d3ccecb42f1549acb Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 7 Dec 2009 07:18:48 -0500 Subject: be --dir DIR COMMAND now roots the bugdir in DIR without changing directories. Previously, for the directory structure A |-- X `-- Y You could do something like A$ be --dir X diff --dir ../Y Now it's A$ be --dir X diff --dir Y The --root option to `be init` has been removed as redundant. Replace calls like be init --root DIR with be --dir DIR init --- becommands/remove.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'becommands/remove.py') diff --git a/becommands/remove.py b/becommands/remove.py index e4f0065..bac06c0 100644 --- a/becommands/remove.py +++ b/becommands/remove.py @@ -18,7 +18,8 @@ from libbe import cmdutil, bugdir __desc__ = __doc__ -def execute(args, manipulate_encodings=True, restrict_file_access=False): +def execute(args, manipulate_encodings=True, restrict_file_access=False, + dir="."): """ >>> from libbe import mapfile >>> import os @@ -43,7 +44,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False): if len(args) != 1: raise cmdutil.UsageError, "Please specify a bug id." bd = bugdir.BugDir(from_disk=True, - manipulate_encodings=manipulate_encodings) + manipulate_encodings=manipulate_encodings, + root=dir) bug = cmdutil.bug_from_id(bd, args[0]) bd.remove_bug(bug) print "Removed bug %s" % bug.uuid -- cgit From 49a7771336ce09f6d42c7699ef32aecea0e83182 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 7 Dec 2009 20:07:55 -0500 Subject: Initial directory restructuring to clarify dependencies --- becommands/remove.py | 65 ---------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 becommands/remove.py (limited to 'becommands/remove.py') diff --git a/becommands/remove.py b/becommands/remove.py deleted file mode 100644 index bac06c0..0000000 --- a/becommands/remove.py +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) 2008-2009 Gianluca Montecchi -# W. Trevor King -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"""Remove (delete) a bug and its comments""" -from libbe import cmdutil, bugdir -__desc__ = __doc__ - -def execute(args, manipulate_encodings=True, restrict_file_access=False, - dir="."): - """ - >>> from libbe import mapfile - >>> import os - >>> bd = bugdir.SimpleBugDir() - >>> os.chdir(bd.root) - >>> print bd.bug_from_shortname("b").status - closed - >>> execute (["b"], manipulate_encodings=False) - Removed bug b - >>> bd._clear_bugs() - >>> try: - ... bd.bug_from_shortname("b") - ... except bugdir.NoBugMatches: - ... print "Bug not found" - Bug not found - >>> bd.cleanup() - """ - parser = get_parser() - options, args = parser.parse_args(args) - cmdutil.default_complete(options, args, parser, - 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=manipulate_encodings, - root=dir) - bug = cmdutil.bug_from_id(bd, args[0]) - bd.remove_bug(bug) - print "Removed bug %s" % bug.uuid - -def get_parser(): - parser = cmdutil.CmdOptionParser("be remove BUG-ID") - return parser - -longhelp=""" -Remove (delete) an existing bug. Use with caution: if you're not using a -revision control system, there may be no way to recover the lost information. -You should use this command, for example, to get rid of blank or otherwise -mangled bugs. -""" - -def help(): - return get_parser().help_str() + longhelp -- cgit