aboutsummaryrefslogtreecommitdiffstats
path: root/becommands
diff options
context:
space:
mode:
Diffstat (limited to 'becommands')
-rw-r--r--becommands/assign.py11
-rw-r--r--becommands/close.py7
-rw-r--r--becommands/comment.py19
-rw-r--r--becommands/depend.py13
-rw-r--r--becommands/diff.py7
-rw-r--r--becommands/help.py6
-rw-r--r--becommands/init.py12
-rw-r--r--becommands/list.py14
-rw-r--r--becommands/merge.py7
-rw-r--r--becommands/new.py7
-rw-r--r--becommands/open.py7
-rw-r--r--becommands/remove.py7
-rw-r--r--becommands/set.py15
-rw-r--r--becommands/severity.py13
-rw-r--r--becommands/show.py9
-rw-r--r--becommands/status.py16
-rw-r--r--becommands/tag.py21
-rw-r--r--becommands/target.py17
18 files changed, 118 insertions, 90 deletions
diff --git a/becommands/assign.py b/becommands/assign.py
index 536bca6..ba79aac 100644
--- a/becommands/assign.py
+++ b/becommands/assign.py
@@ -20,7 +20,7 @@
from libbe import cmdutil, bugdir
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> import os
>>> bd = bugdir.simple_bug_dir()
@@ -28,17 +28,17 @@ def execute(args, test=False):
>>> bd.bug_from_shortname("a").assigned is None
True
- >>> execute(["a"], test=True)
+ >>> execute(["a"], manipulate_encodings=False)
>>> bd._clear_bugs()
>>> bd.bug_from_shortname("a").assigned == bd.user_id
True
- >>> execute(["a", "someone"], test=True)
+ >>> execute(["a", "someone"], manipulate_encodings=False)
>>> bd._clear_bugs()
>>> print bd.bug_from_shortname("a").assigned
someone
- >>> execute(["a","none"], test=True)
+ >>> execute(["a","none"], manipulate_encodings=False)
>>> bd._clear_bugs()
>>> bd.bug_from_shortname("a").assigned is None
True
@@ -53,7 +53,8 @@ def execute(args, test=False):
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 = bd.bug_from_shortname(args[0])
if len(args) == 1:
bug.assigned = bd.user_id
diff --git a/becommands/close.py b/becommands/close.py
index 0ba8f50..05bdc10 100644
--- a/becommands/close.py
+++ b/becommands/close.py
@@ -20,7 +20,7 @@
from libbe import cmdutil, bugdir
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> from libbe import bugdir
>>> import os
@@ -28,7 +28,7 @@ def execute(args, test=False):
>>> os.chdir(bd.root)
>>> print bd.bug_from_shortname("a").status
open
- >>> execute(["a"], test=True)
+ >>> execute(["a"], manipulate_encodings=False)
>>> bd._clear_bugs()
>>> print bd.bug_from_shortname("a").status
closed
@@ -41,7 +41,8 @@ def execute(args, test=False):
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.status = "closed"
bd.save()
diff --git a/becommands/comment.py b/becommands/comment.py
index 66f8da1..918f922 100644
--- a/becommands/comment.py
+++ b/becommands/comment.py
@@ -25,12 +25,12 @@ except ImportError: # look for non-core module
from elementtree import ElementTree
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> 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.load_comments(load_full=False)
@@ -47,12 +47,12 @@ def execute(args, test=False):
>>> if 'EDITOR' in os.environ:
... del os.environ["EDITOR"]
- >>> execute(["b"], test=True)
+ >>> execute(["b"], manipulate_encodings=False)
Traceback (most recent call last):
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.load_comments(load_full=False)
@@ -80,7 +80,8 @@ def execute(args, test=False):
bugname = shortname
is_reply = False
- 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(bugname)
bug.load_comments(load_full=False)
if is_reply:
@@ -113,6 +114,10 @@ def execute(args, test=False):
if options.XML == False:
new = parent.new_reply(body=body)
+ if options.author != None:
+ new.From = options.author
+ if options.alt_id != None:
+ new.alt_id = options.alt_id
if options.content_type != None:
new.content_type = options.content_type
else: # import XML comment [list]
@@ -157,6 +162,10 @@ def execute(args, test=False):
def get_parser():
parser = cmdutil.CmdOptionParser("be comment ID [COMMENT]")
+ parser.add_option("-a", "--author", metavar="AUTHOR", dest="author",
+ help="Set the comment author", default=None)
+ parser.add_option("--alt-id", metavar="ID", dest="alt_id",
+ help="Set an alternate comment ID", default=None)
parser.add_option("-c", "--content-type", metavar="MIME", dest="content_type",
help="Set comment content-type (e.g. text/plain)", default=None)
parser.add_option("-x", "--xml", action="store_true", default=False,
diff --git a/becommands/depend.py b/becommands/depend.py
index 48e1527..977edae 100644
--- a/becommands/depend.py
+++ b/becommands/depend.py
@@ -18,22 +18,22 @@ from libbe import cmdutil, bugdir
import os, copy
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> from libbe import utility
>>> bd = bugdir.simple_bug_dir()
>>> bd.save()
>>> os.chdir(bd.root)
- >>> execute(["a", "b"], test=True)
+ >>> execute(["a", "b"], manipulate_encodings=False)
Blocks on a:
b
- >>> execute(["a"], test=True)
+ >>> execute(["a"], manipulate_encodings=False)
Blocks on a:
b
- >>> execute(["--show-status", "a"], test=True) # doctest: +NORMALIZE_WHITESPACE
+ >>> execute(["--show-status", "a"], manipulate_encodings=False) # doctest: +NORMALIZE_WHITESPACE
Blocks on a:
b closed
- >>> execute(["-r", "a", "b"], test=True)
+ >>> execute(["-r", "a", "b"], manipulate_encodings=False)
"""
parser = get_parser()
options, args = parser.parse_args(args)
@@ -47,7 +47,8 @@ def execute(args, test=False):
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])
if len(args) == 2:
bugB = bd.bug_from_shortname(args[1])
diff --git a/becommands/diff.py b/becommands/diff.py
index f3474b3..20fcb4c 100644
--- a/becommands/diff.py
+++ b/becommands/diff.py
@@ -20,7 +20,7 @@ from libbe import cmdutil, bugdir, diff
import os
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> import os
>>> bd = bugdir.simple_bug_dir()
@@ -31,7 +31,7 @@ def execute(args, test=False):
>>> changed = bd.rcs.commit("Closed bug a")
>>> os.chdir(bd.root)
>>> if bd.rcs.versioned == True:
- ... execute([original], test=True)
+ ... execute([original], manipulate_encodings=False)
... else:
... print "a:cm: Bug A\\nstatus: open -> closed\\n"
Modified bug reports:
@@ -48,7 +48,8 @@ def execute(args, test=False):
revision = args[0]
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)
if bd.rcs.versioned == False:
print "This directory is not revision-controlled."
else:
diff --git a/becommands/help.py b/becommands/help.py
index a8ae338..a8f346a 100644
--- a/becommands/help.py
+++ b/becommands/help.py
@@ -19,9 +19,11 @@
from libbe import cmdutil, utility
__desc__ = __doc__
-def execute(args):
+def execute(args, manipulate_encodings=False):
"""
- Print help of specified command.
+ Print help of specified command (the manipulate_encodings argument
+ is ignored).
+
>>> execute(["help"])
Usage: be help [COMMAND]
<BLANKLINE>
diff --git a/becommands/init.py b/becommands/init.py
index 5b2a416..4156a26 100644
--- a/becommands/init.py
+++ b/becommands/init.py
@@ -19,7 +19,7 @@ import os.path
from libbe import cmdutil, bugdir
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> from libbe import utility, rcs
>>> import os
@@ -29,7 +29,7 @@ def execute(args, test=False):
... except bugdir.NoBugDir, e:
... True
True
- >>> execute(['--root', dir.path], test=True)
+ >>> execute(['--root', dir.path], manipulate_encodings=False)
No revision control detected.
Directory initialized.
>>> del(dir)
@@ -40,17 +40,17 @@ def execute(args, test=False):
>>> rcs.init('.')
>>> print rcs.name
Arch
- >>> execute([], test=True)
+ >>> execute([], manipulate_encodings=False)
Using Arch for revision control.
Directory initialized.
>>> rcs.cleanup()
>>> try:
- ... execute(['--root', '.'], test=True)
+ ... execute(['--root', '.'], manipulate_encodings=False)
... except cmdutil.UserError, e:
... str(e).startswith("Directory already initialized: ")
True
- >>> execute(['--root', '/highly-unlikely-to-exist'], test=True)
+ >>> execute(['--root', '/highly-unlikely-to-exist'], manipulate_encodings=False)
Traceback (most recent call last):
UserError: No such directory: /highly-unlikely-to-exist
>>> os.chdir('/')
@@ -64,7 +64,7 @@ def execute(args, test=False):
bd = bugdir.BugDir(options.root_dir, from_disk=False,
sink_to_existing_root=False,
assert_new_BugDir=True,
- manipulate_encodings=not test)
+ manipulate_encodings=manipulate_encodings)
except bugdir.NoRootEntry:
raise cmdutil.UserError("No such directory: %s" % options.root_dir)
except bugdir.AlreadyInitialized:
diff --git a/becommands/list.py b/becommands/list.py
index 5ba1821..50038e6 100644
--- a/becommands/list.py
+++ b/becommands/list.py
@@ -26,14 +26,14 @@ __desc__ = __doc__
AVAILABLE_CMPS = [fn[4:] for fn in dir(bug) if fn[:4] == 'cmp_']
AVAILABLE_CMPS.remove("attr") # a cmp_* template.
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> import os
>>> bd = bugdir.simple_bug_dir()
>>> os.chdir(bd.root)
- >>> execute([], test=True)
+ >>> execute([], manipulate_encodings=False)
a:om: Bug A
- >>> execute(["--status", "all"], test=True)
+ >>> execute(["--status", "all"], manipulate_encodings=False)
a:om: Bug A
b:cm: Bug B
"""
@@ -46,11 +46,13 @@ def execute(args, test=False):
if options.sort_by != None:
for cmp in options.sort_by.split(','):
if cmp not in AVAILABLE_CMPS:
- raise cmdutil.UserError("Invalid sort on '%s'.\nValid sorts:\n %s"
- % (cmp, '\n '.join(AVAILABLE_CMPS)))
+ raise cmdutil.UserError(
+ "Invalid sort on '%s'.\nValid sorts:\n %s"
+ % (cmp, '\n '.join(AVAILABLE_CMPS)))
cmp_list.append(eval('bug.cmp_%s' % cmp))
- bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test)
+ bd = bugdir.BugDir(from_disk=True,
+ manipulate_encodings=manipulate_encodings)
bd.load_all_bugs()
# select status
if options.status != None:
diff --git a/becommands/merge.py b/becommands/merge.py
index c030dd0..c7cae2b 100644
--- a/becommands/merge.py
+++ b/becommands/merge.py
@@ -18,7 +18,7 @@ from libbe import cmdutil, bugdir
import os, copy
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> from libbe import utility
>>> bd = bugdir.simple_bug_dir()
@@ -37,7 +37,7 @@ def execute(args, test=False):
>>> dummy.time = 2
>>> bd.save()
>>> os.chdir(bd.root)
- >>> execute(["a", "b"], test=True)
+ >>> execute(["a", "b"], manipulate_encodings=False)
Merging bugs a and b
>>> bd._clear_bugs()
>>> a = bd.bug_from_shortname("a")
@@ -133,7 +133,8 @@ def execute(args, test=False):
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.load_comments()
bugB = bd.bug_from_shortname(args[1])
diff --git a/becommands/new.py b/becommands/new.py
index 5325ccc..8512e22 100644
--- a/becommands/new.py
+++ b/becommands/new.py
@@ -19,14 +19,14 @@ from libbe import cmdutil, bugdir
import sys
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> import os, time
>>> from libbe import bug
>>> bd = bugdir.simple_bug_dir()
>>> os.chdir(bd.root)
>>> bug.uuid_gen = lambda: "X"
- >>> execute (["this is a test",], test=True)
+ >>> execute (["this is a test",], manipulate_encodings=False)
Created bug with ID X
>>> bd.load()
>>> bug = bd.bug_from_uuid("X")
@@ -44,7 +44,8 @@ def execute(args, test=False):
cmdutil.default_complete(options, args, parser)
if len(args) != 1:
raise cmdutil.UsageError("Please supply a summary message")
- bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test)
+ bd = bugdir.BugDir(from_disk=True,
+ manipulate_encodings=manipulate_encodings)
if args[0] == '-': # read summary from stdin
summary = sys.stdin.readline()
else:
diff --git a/becommands/open.py b/becommands/open.py
index b4b1025..ee81422 100644
--- a/becommands/open.py
+++ b/becommands/open.py
@@ -20,14 +20,14 @@
from libbe import cmdutil, bugdir
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> import os
>>> bd = bugdir.simple_bug_dir()
>>> os.chdir(bd.root)
>>> print bd.bug_from_shortname("b").status
closed
- >>> execute(["b"], test=True)
+ >>> execute(["b"], manipulate_encodings=False)
>>> bd._clear_bugs()
>>> print bd.bug_from_shortname("b").status
open
@@ -40,7 +40,8 @@ def execute(args, test=False):
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.status = "open"
bd.save()
diff --git a/becommands/remove.py b/becommands/remove.py
index d441bfe..d6ba999 100644
--- a/becommands/remove.py
+++ b/becommands/remove.py
@@ -17,7 +17,7 @@
from libbe import cmdutil, bugdir
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> from libbe import mapfile
>>> import os
@@ -25,7 +25,7 @@ def execute(args, test=False):
>>> os.chdir(bd.root)
>>> print bd.bug_from_shortname("b").status
closed
- >>> execute (["b"], test=True)
+ >>> execute (["b"], manipulate_encodings=False)
Removed bug b
>>> bd._clear_bugs()
>>> try:
@@ -40,7 +40,8 @@ def execute(args, test=False):
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])
bd.remove_bug(bug)
bd.save()
diff --git a/becommands/set.py b/becommands/set.py
index 510eca7..7bef644 100644
--- a/becommands/set.py
+++ b/becommands/set.py
@@ -32,18 +32,18 @@ def _value_string(bd, setting):
val = None
return str(val)
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> import os
>>> bd = bugdir.simple_bug_dir()
>>> os.chdir(bd.root)
- >>> execute(["target"], test=True)
+ >>> execute(["target"], manipulate_encodings=False)
None
- >>> execute(["target", "tomorrow"], test=True)
- >>> execute(["target"], test=True)
+ >>> execute(["target", "tomorrow"], manipulate_encodings=False)
+ >>> execute(["target"], manipulate_encodings=False)
tomorrow
- >>> execute(["target", "none"], test=True)
- >>> execute(["target"], test=True)
+ >>> execute(["target", "none"], manipulate_encodings=False)
+ >>> execute(["target"], manipulate_encodings=False)
None
"""
parser = get_parser()
@@ -51,7 +51,8 @@ def execute(args, test=False):
complete(options, args, parser)
if len(args) > 2:
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)
if len(args) == 0:
keys = bd.settings_properties
keys.sort()
diff --git a/becommands/severity.py b/becommands/severity.py
index fde9fba..4e95638 100644
--- a/becommands/severity.py
+++ b/becommands/severity.py
@@ -20,17 +20,17 @@
from libbe import cmdutil, bugdir, bug
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> import os
>>> bd = bugdir.simple_bug_dir()
>>> os.chdir(bd.root)
- >>> execute(["a"], test=True)
+ >>> execute(["a"], manipulate_encodings=False)
minor
- >>> execute(["a", "wishlist"], test=True)
- >>> execute(["a"], test=True)
+ >>> execute(["a", "wishlist"], manipulate_encodings=False)
+ >>> execute(["a"], manipulate_encodings=False)
wishlist
- >>> execute(["a", "none"], test=True)
+ >>> execute(["a", "none"], manipulate_encodings=False)
Traceback (most recent call last):
UserError: Invalid severity level: none
"""
@@ -39,7 +39,8 @@ def execute(args, test=False):
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])
if len(args) == 1:
print bug.severity
diff --git a/becommands/show.py b/becommands/show.py
index d053cc3..ae1c7f3 100644
--- a/becommands/show.py
+++ b/becommands/show.py
@@ -22,12 +22,12 @@ import sys
from libbe import cmdutil, bugdir
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> import os
>>> bd = bugdir.simple_bug_dir()
>>> os.chdir(bd.root)
- >>> execute (["a",], test=True) # doctest: +ELLIPSIS
+ >>> execute (["a",], manipulate_encodings=False) # doctest: +ELLIPSIS
ID : a
Short name : a
Severity : minor
@@ -39,7 +39,7 @@ def execute(args, test=False):
Created : ...
Bug A
<BLANKLINE>
- >>> execute (["--xml", "a"], test=True) # doctest: +ELLIPSIS
+ >>> execute (["--xml", "a"], manipulate_encodings=False) # doctest: +ELLIPSIS
<?xml version="1.0" encoding="..." ?>
<bug>
<uuid>a</uuid>
@@ -57,7 +57,8 @@ def execute(args, test=False):
bugid_args={-1: lambda bug : bug.active==True})
if len(args) == 0:
raise cmdutil.UsageError
- bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test)
+ bd = bugdir.BugDir(from_disk=True,
+ manipulate_encodings=manipulate_encodings)
for shortname in args:
if shortname.count(':') > 1:
raise cmdutil.UserError("Invalid id '%s'." % shortname)
diff --git a/becommands/status.py b/becommands/status.py
index 89ae49a..a122aec 100644
--- a/becommands/status.py
+++ b/becommands/status.py
@@ -17,17 +17,17 @@
from libbe import cmdutil, bugdir, bug
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> import os
>>> bd = bugdir.simple_bug_dir()
>>> os.chdir(bd.root)
- >>> execute(["a"], test=True)
+ >>> execute(["a"], manipulate_encodings=False)
open
- >>> execute(["a", "closed"], test=True)
- >>> execute(["a"], test=True)
+ >>> execute(["a", "closed"], manipulate_encodings=False)
+ >>> execute(["a"], manipulate_encodings=False)
closed
- >>> execute(["a", "none"], test=True)
+ >>> execute(["a", "none"], manipulate_encodings=False)
Traceback (most recent call last):
UserError: Invalid status: none
"""
@@ -36,7 +36,8 @@ def execute(args, test=False):
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])
if len(args) == 1:
print bug.status
@@ -56,7 +57,8 @@ def get_parser():
def help():
try: # See if there are any per-tree status configurations
- bd = bugdir.BugDir(from_disk=True, manipulate_encodings=False)
+ bd = bugdir.BugDir(from_disk=True,
+ manipulate_encodings=False)
except bugdir.NoBugDir, e:
pass # No tree, just show the defaults
longest_status_len = max([len(s) for s in bug.status_values])
diff --git a/becommands/tag.py b/becommands/tag.py
index a139528..2932589 100644
--- a/becommands/tag.py
+++ b/becommands/tag.py
@@ -18,7 +18,7 @@ from libbe import cmdutil, bugdir
import os, copy
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> from libbe import utility
>>> bd = bugdir.simple_bug_dir()
@@ -26,25 +26,25 @@ def execute(args, test=False):
>>> a = bd.bug_from_shortname("a")
>>> print a.extra_strings
[]
- >>> execute(["a", "GUI"], test=True)
+ >>> execute(["a", "GUI"], manipulate_encodings=False)
Tags for a:
GUI
>>> bd._clear_bugs() # resync our copy of bug
>>> a = bd.bug_from_shortname("a")
>>> print a.extra_strings
['TAG:GUI']
- >>> execute(["a", "later"], test=True)
+ >>> execute(["a", "later"], manipulate_encodings=False)
Tags for a:
GUI
later
- >>> execute(["a"], test=True)
+ >>> execute(["a"], manipulate_encodings=False)
Tags for a:
GUI
later
- >>> execute(["--list"], test=True)
+ >>> execute(["--list"], manipulate_encodings=False)
GUI
later
- >>> execute(["a", "Alphabetically first"], test=True)
+ >>> execute(["a", "Alphabetically first"], manipulate_encodings=False)
Tags for a:
Alphabetically first
GUI
@@ -57,15 +57,15 @@ def execute(args, test=False):
>>> print a.extra_strings
[]
>>> a.save()
- >>> execute(["a"], test=True)
+ >>> execute(["a"], manipulate_encodings=False)
>>> bd._clear_bugs() # resync our copy of bug
>>> a = bd.bug_from_shortname("a")
>>> print a.extra_strings
[]
- >>> execute(["a", "Alphabetically first"], test=True)
+ >>> execute(["a", "Alphabetically first"], manipulate_encodings=False)
Tags for a:
Alphabetically first
- >>> execute(["--remove", "a", "Alphabetically first"], test=True)
+ >>> execute(["--remove", "a", "Alphabetically first"], manipulate_encodings=False)
"""
parser = get_parser()
options, args = parser.parse_args(args)
@@ -78,7 +78,8 @@ def execute(args, test=False):
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)
if options.list:
bd.load_all_bugs()
tags = []
diff --git a/becommands/target.py b/becommands/target.py
index 905c639..66bacb8 100644
--- a/becommands/target.py
+++ b/becommands/target.py
@@ -22,20 +22,20 @@
from libbe import cmdutil, bugdir
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> import os
>>> bd = bugdir.simple_bug_dir()
>>> os.chdir(bd.root)
- >>> execute(["a"], test=True)
+ >>> execute(["a"], manipulate_encodings=False)
No target assigned.
- >>> execute(["a", "tomorrow"], test=True)
- >>> execute(["a"], test=True)
+ >>> execute(["a", "tomorrow"], manipulate_encodings=False)
+ >>> execute(["a"], manipulate_encodings=False)
tomorrow
- >>> execute(["--list"], test=True)
+ >>> execute(["--list"], manipulate_encodings=False)
tomorrow
- >>> execute(["a", "none"], test=True)
- >>> execute(["a"], test=True)
+ >>> execute(["a", "none"], manipulate_encodings=False)
+ >>> execute(["a"], manipulate_encodings=False)
No target assigned.
"""
parser = get_parser()
@@ -46,7 +46,8 @@ def execute(args, test=False):
if len(args) not in (1, 2):
if not (options.list == True and len(args) == 0):
raise cmdutil.UsageError
- bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test)
+ bd = bugdir.BugDir(from_disk=True,
+ manipulate_encodings=manipulate_encodings)
if options.list:
ts = set([bd.bug_from_uuid(bug).target for bug in bd.list_uuids()])
for target in sorted(ts):