aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-12-07 07:18:48 -0500
committerW. Trevor King <wking@drexel.edu>2009-12-07 07:18:48 -0500
commitfdf9925ffaada614544d1b2d3ccecb42f1549acb (patch)
tree4050e78947cd847d17e2de399da7a1d4d794820c
parentfc131e3acbf657f42959910c4f4483a09c871016 (diff)
downloadbugseverywhere-fdf9925ffaada614544d1b2d3ccecb42f1549acb.tar.gz
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
-rw-r--r--.be/bugs/52034fd0-ec50-424d-b25d-2beaf2d2c317/comments/79fb6ef2-176c-45c0-b898-59c3c3e0aafe/body13
-rw-r--r--.be/bugs/52034fd0-ec50-424d-b25d-2beaf2d2c317/comments/79fb6ef2-176c-45c0-b898-59c3c3e0aafe/values11
-rw-r--r--NEWS5
-rw-r--r--README.dev5
-rwxr-xr-xbe8
-rw-r--r--becommands/assign.py6
-rw-r--r--becommands/close.py6
-rw-r--r--becommands/comment.py6
-rw-r--r--becommands/commit.py6
-rw-r--r--becommands/depend.py6
-rw-r--r--becommands/diff.py6
-rw-r--r--becommands/due.py6
-rw-r--r--becommands/email_bugs.py6
-rw-r--r--becommands/help.py3
-rw-r--r--becommands/html.py6
-rw-r--r--becommands/import_xml.py6
-rw-r--r--becommands/init.py26
-rw-r--r--becommands/list.py6
-rw-r--r--becommands/merge.py6
-rw-r--r--becommands/new.py6
-rw-r--r--becommands/open.py6
-rw-r--r--becommands/remove.py6
-rw-r--r--becommands/set.py6
-rw-r--r--becommands/severity.py6
-rw-r--r--becommands/show.py6
-rw-r--r--becommands/status.py6
-rw-r--r--becommands/subscribe.py6
-rw-r--r--becommands/tag.py6
-rw-r--r--becommands/target.py6
-rw-r--r--libbe/cmdutil.py7
30 files changed, 145 insertions, 65 deletions
diff --git a/.be/bugs/52034fd0-ec50-424d-b25d-2beaf2d2c317/comments/79fb6ef2-176c-45c0-b898-59c3c3e0aafe/body b/.be/bugs/52034fd0-ec50-424d-b25d-2beaf2d2c317/comments/79fb6ef2-176c-45c0-b898-59c3c3e0aafe/body
new file mode 100644
index 0000000..7dbeebb
--- /dev/null
+++ b/.be/bugs/52034fd0-ec50-424d-b25d-2beaf2d2c317/comments/79fb6ef2-176c-45c0-b898-59c3c3e0aafe/body
@@ -0,0 +1,13 @@
+> * Determining what to commit.
+>
+> You'd have to have RCS keep a log of all versioned files it
+> touched, and extend .commit() to accept the keyword list "files"
+> and commit only those files. This is doable, but maybe not worth
+> the trouble.
+
+On the other hand, just attemting to commit evverything after each
+command would make it nice and easy to commit bug fixes:
+ be --auto-commit status XYZ fixed
+which would commit whatever changes you had outstanding with an
+appropriate commit message.
+
diff --git a/.be/bugs/52034fd0-ec50-424d-b25d-2beaf2d2c317/comments/79fb6ef2-176c-45c0-b898-59c3c3e0aafe/values b/.be/bugs/52034fd0-ec50-424d-b25d-2beaf2d2c317/comments/79fb6ef2-176c-45c0-b898-59c3c3e0aafe/values
new file mode 100644
index 0000000..b3dba3f
--- /dev/null
+++ b/.be/bugs/52034fd0-ec50-424d-b25d-2beaf2d2c317/comments/79fb6ef2-176c-45c0-b898-59c3c3e0aafe/values
@@ -0,0 +1,11 @@
+Author: W. Trevor King <wking@drexel.edu>
+
+
+Content-type: text/plain
+
+
+Date: Sun, 06 Dec 2009 21:45:15 +0000
+
+
+In-reply-to: 4c50ca0b-a08f-4723-b00d-4bf342cf86b6
+
diff --git a/NEWS b/NEWS
index 0cf9aae..84256e1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+December 6, 2009
+ * be --dir DIR COMMAND now roots the bugdir in DIR _without_ changing
+ directories.
+ * `be init --root DIR` should now be `be --dir DIR init`.
+
December 5, 2009
* targets are now a special type of bug (severity 'target'), so you
can do all the things you do with normal bugs to them as well
diff --git a/README.dev b/README.dev
index fb4f471..dbb97b0 100644
--- a/README.dev
+++ b/README.dev
@@ -10,7 +10,8 @@ To fit into the current framework, your extension module should
provide the following elements:
__desc__
A short string describing the purpose of your plugin
- execute(args, manipulate_encodings=True, restrict_file_access=False)
+ execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir=".")
The entry function for your plugin. args is everything from
sys.argv after the name of your plugin (e.g. for the command
`be open abc', args=['abc']).
@@ -23,6 +24,8 @@ provide the following elements:
before attempting to read or write a file. See the
restrict_file_access documentation for details.
+ dir is a directory inside the repository of interest.
+
Note: be supports command-completion. To avoid raising errors you
need to deal with possible '--complete' options and arguments.
See the 'Command completion' section below for more information.
diff --git a/be b/be
index c5c372f..8a594cf 100755
--- a/be
+++ b/be
@@ -34,8 +34,8 @@ parser.add_option("--version", action="store_true", dest="version",
help="Print version string and exit.")
parser.add_option("--verbose-version", action="store_true", dest="verbose_version",
help="Print verbose version information and exit.")
-parser.add_option("-d", "--dir", dest="dir", metavar="DIR",
- help="Run this command from DIR instead of the current directory.")
+parser.add_option("-d", "--dir", dest="dir", metavar="DIR", default=".",
+ help="Run this command on the repository in DIR instead of the current directory.")
try:
options,args = parser.parse_args()
@@ -56,13 +56,11 @@ except cmdutil.GetCompletions, e:
if options.version == True or options.verbose_version == True:
print version.version(verbose=options.verbose_version)
sys.exit(0)
-if options.dir != None:
- os.chdir(options.dir)
try:
if len(args) == 0:
raise cmdutil.UsageError, "must supply a command"
- sys.exit(cmdutil.execute(args[0], args[1:]))
+ sys.exit(cmdutil.execute(args[0], args=args[1:], dir=options.dir))
except cmdutil.GetHelp:
print cmdutil.help(args[0])
sys.exit(0)
diff --git a/becommands/assign.py b/becommands/assign.py
index 2c78f69..9c971ae 100644
--- a/becommands/assign.py
+++ b/becommands/assign.py
@@ -21,7 +21,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="."):
"""
>>> import os
>>> bd = bugdir.SimpleBugDir()
@@ -56,7 +57,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
help()
raise cmdutil.UsageError("Too many arguments.")
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
bug = cmdutil.bug_from_id(bd, args[0])
bug = bd.bug_from_shortname(args[0])
if len(args) == 1:
diff --git a/becommands/close.py b/becommands/close.py
index a14cea8..026c605 100644
--- a/becommands/close.py
+++ b/becommands/close.py
@@ -21,7 +21,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 bugdir
>>> import os
@@ -44,7 +45,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
if len(args) > 1:
raise cmdutil.UsageError("Too many arguments.")
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
bug = cmdutil.bug_from_id(bd, args[0])
bug.status = "closed"
bd.save()
diff --git a/becommands/comment.py b/becommands/comment.py
index fbc994f..9919d1d 100644
--- a/becommands/comment.py
+++ b/becommands/comment.py
@@ -21,7 +21,8 @@ import os
import sys
__desc__ = __doc__
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import time
>>> bd = bugdir.SimpleBugDir()
@@ -69,7 +70,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
shortname = args[0]
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
bug, parent = cmdutil.bug_comment_from_id(bd, shortname)
if len(args) == 1: # try to launch an editor for comment-body entry
diff --git a/becommands/commit.py b/becommands/commit.py
index 39d1e2e..cade355 100644
--- a/becommands/commit.py
+++ b/becommands/commit.py
@@ -18,7 +18,8 @@ from libbe import cmdutil, bugdir, editor, vcs
import sys
__desc__ = __doc__
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import os
>>> from libbe import bug
@@ -37,7 +38,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
if len(args) != 1:
raise cmdutil.UsageError("Please supply a commit message")
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
if args[0] == '-': # read summary from stdin
assert options.body != "EDITOR", \
"Cannot spawn and editor when the summary is using stdin."
diff --git a/becommands/depend.py b/becommands/depend.py
index 6336793..c2cb2a4 100644
--- a/becommands/depend.py
+++ b/becommands/depend.py
@@ -35,7 +35,8 @@ class BrokenLink (Exception):
self.blocking_bug = blocking_bug
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> from libbe import utility
>>> bd = bugdir.SimpleBugDir()
@@ -84,7 +85,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
raise cmdutil.UsageError("Only one bug id used in tree mode.")
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
if options.repair == True:
good,fixed,broken = check_dependencies(bd, repair_broken_links=True)
assert len(broken) == 0, broken
diff --git a/becommands/diff.py b/becommands/diff.py
index e844c10..c5c34f9 100644
--- a/becommands/diff.py
+++ b/becommands/diff.py
@@ -21,7 +21,8 @@ from libbe import cmdutil, bugdir, diff
import os
__desc__ = __doc__
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import os
>>> bd = bugdir.SimpleBugDir()
@@ -69,7 +70,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
except ValueError, e:
raise cmdutil.UsageError(e.msg)
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
if bd.vcs.versioned == False:
raise cmdutil.UsageError('This directory is not revision-controlled.')
if options.dir == None:
diff --git a/becommands/due.py b/becommands/due.py
index 6f11ad4..0b8d1e9 100644
--- a/becommands/due.py
+++ b/becommands/due.py
@@ -19,7 +19,8 @@ __desc__ = __doc__
DUE_TAG="DUE:"
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import os
>>> bd = bugdir.SimpleBugDir()
@@ -43,7 +44,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
if len(args) not in (1, 2):
raise cmdutil.UsageError('Incorrect number of arguments.')
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
bug = cmdutil.bug_from_id(bd, args[0])
if len(args) == 1:
due_time = get_due(bug)
diff --git a/becommands/email_bugs.py b/becommands/email_bugs.py
index d0366df..f6641e3 100644
--- a/becommands/email_bugs.py
+++ b/becommands/email_bugs.py
@@ -33,7 +33,8 @@ __desc__ = __doc__
sendmail='/usr/sbin/sendmail -t'
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import os
>>> from libbe import bug
@@ -96,7 +97,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
if len(args) == 0:
raise cmdutil.UsageError
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
xml = show.output(args, bd, as_xml=True, with_comments=True)
subject = options.subject
if subject == None:
diff --git a/becommands/help.py b/becommands/help.py
index 99ab8c4..9e6d1aa 100644
--- a/becommands/help.py
+++ b/becommands/help.py
@@ -20,7 +20,8 @@
from libbe import cmdutil, utility
__desc__ = __doc__
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
Print help of specified command (the manipulate_encodings argument
is ignored).
diff --git a/becommands/html.py b/becommands/html.py
index a031188..d9e0d73 100644
--- a/becommands/html.py
+++ b/becommands/html.py
@@ -21,7 +21,8 @@ import xml.sax.saxutils, htmlentitydefs
__desc__ = __doc__
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import os
>>> bd = bugdir.SimpleBugDir()
@@ -50,7 +51,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
raise cmdutil.UsageError, 'Too many arguments.'
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
bd.load_all_bugs()
html_gen = HTMLGen(bd, template=options.template, verbose=options.verbose,
diff --git a/becommands/import_xml.py b/becommands/import_xml.py
index d1ea026..b985193 100644
--- a/becommands/import_xml.py
+++ b/becommands/import_xml.py
@@ -29,7 +29,8 @@ if libbe.TESTING == True:
import unittest
__desc__ = __doc__
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import time
>>> import StringIO
@@ -64,7 +65,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
filename = args[0]
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
if options.comment_root != None:
croot_bug,croot_comment = \
cmdutil.bug_comment_from_id(bd, options.comment_root)
diff --git a/becommands/init.py b/becommands/init.py
index 6085286..ab9255b 100644
--- a/becommands/init.py
+++ b/becommands/init.py
@@ -20,7 +20,8 @@ import os.path
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 utility, vcs
>>> import os
@@ -30,7 +31,7 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
... except bugdir.NoBugDir, e:
... True
True
- >>> execute(['--root', dir.path], manipulate_encodings=False)
+ >>> execute([], manipulate_encodings=False, dir=dir.path)
No revision control detected.
Directory initialized.
>>> dir.cleanup()
@@ -47,11 +48,12 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
>>> _vcs.cleanup()
>>> try:
- ... execute(['--root', '.'], manipulate_encodings=False)
+ ... execute([], manipulate_encodings=False, dir=".")
... except cmdutil.UserError, e:
... str(e).startswith("Directory already initialized: ")
True
- >>> execute(['--root', '/highly-unlikely-to-exist'], manipulate_encodings=False)
+ >>> execute([], manipulate_encodings=False,
+ ... dir='/highly-unlikely-to-exist')
Traceback (most recent call last):
UserError: No such directory: /highly-unlikely-to-exist
>>> os.chdir('/')
@@ -63,14 +65,15 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
if len(args) > 0:
raise cmdutil.UsageError
try:
- bd = bugdir.BugDir(options.root_dir, from_disk=False,
+ bd = bugdir.BugDir(from_disk=False,
sink_to_existing_root=False,
assert_new_BugDir=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
except bugdir.NoRootEntry:
- raise cmdutil.UserError("No such directory: %s" % options.root_dir)
+ raise cmdutil.UserError("No such directory: %s" % dir)
except bugdir.AlreadyInitialized:
- raise cmdutil.UserError("Directory already initialized: %s" % options.root_dir)
+ raise cmdutil.UserError("Directory already initialized: %s" % dir)
bd.save()
if bd.vcs.name is not "None":
print "Using %s for revision control." % bd.vcs.name
@@ -80,9 +83,6 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
def get_parser():
parser = cmdutil.CmdOptionParser("be init")
- parser.add_option("-r", "--root", metavar="DIR", dest="root_dir",
- help="Set root dir to something other than the current directory.",
- default=".")
return parser
longhelp="""
@@ -90,7 +90,9 @@ This command initializes Bugs Everywhere support for the specified directory
and all its subdirectories. It will auto-detect any supported revision control
system. You can use "be set vcs_name" to change the vcs being used.
-The directory defaults to your current working directory.
+The directory defaults to your current working directory, but you can
+change that by passing the --dir option to be
+ $ be --dir path/to/new/bug/root init
It is usually a good idea to put the Bugs Everywhere root at the source code
root, but you can put it anywhere. If you root Bugs Everywhere in a
diff --git a/becommands/list.py b/becommands/list.py
index fa5647b..1c3e78d 100644
--- a/becommands/list.py
+++ b/becommands/list.py
@@ -26,7 +26,8 @@ __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, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import os
>>> bd = bugdir.SimpleBugDir()
@@ -52,7 +53,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
cmp_list.append(eval('bug.cmp_%s' % cmp))
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
bd.load_all_bugs()
# select status
if options.status != None:
diff --git a/becommands/merge.py b/becommands/merge.py
index 8cf7e2f..ac09b40 100644
--- a/becommands/merge.py
+++ b/becommands/merge.py
@@ -19,7 +19,8 @@ from libbe import cmdutil, bugdir
import os, copy
__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 utility
>>> bd = bugdir.SimpleBugDir()
@@ -134,7 +135,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
raise cmdutil.UsageError("Too many arguments.")
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
bugA = cmdutil.bug_from_id(bd, args[0])
bugA.load_comments()
bugB = cmdutil.bug_from_id(bd, args[1])
diff --git a/becommands/new.py b/becommands/new.py
index 00e8a47..30f8834 100644
--- a/becommands/new.py
+++ b/becommands/new.py
@@ -20,7 +20,8 @@ from libbe import cmdutil, bugdir
import sys
__desc__ = __doc__
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import os, time
>>> from libbe import bug
@@ -47,7 +48,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
if len(args) != 1:
raise cmdutil.UsageError("Please supply a summary message")
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
if args[0] == '-': # read summary from stdin
summary = sys.stdin.readline()
else:
diff --git a/becommands/open.py b/becommands/open.py
index c2c15e2..a6fe48d 100644
--- a/becommands/open.py
+++ b/becommands/open.py
@@ -21,7 +21,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="."):
"""
>>> import os
>>> bd = bugdir.SimpleBugDir()
@@ -43,7 +44,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
if len(args) > 1:
raise cmdutil.UsageError, "Too many arguments."
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
bug = cmdutil.bug_from_id(bd, args[0])
bug.status = "open"
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
diff --git a/becommands/set.py b/becommands/set.py
index c8c5a2c..4d54a59 100644
--- a/becommands/set.py
+++ b/becommands/set.py
@@ -32,7 +32,8 @@ def _value_string(bd, setting):
val = None
return str(val)
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import os
>>> bd = bugdir.SimpleBugDir()
@@ -53,7 +54,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
if len(args) > 2:
raise cmdutil.UsageError, "Too many arguments"
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
if len(args) == 0:
keys = bd.settings_properties
keys.sort()
diff --git a/becommands/severity.py b/becommands/severity.py
index 524976b..804dc4e 100644
--- a/becommands/severity.py
+++ b/becommands/severity.py
@@ -21,7 +21,8 @@
from libbe import cmdutil, bugdir, bug
__desc__ = __doc__
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import os
>>> bd = bugdir.SimpleBugDir()
@@ -42,7 +43,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
if len(args) not in (1,2):
raise cmdutil.UsageError
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
bug = cmdutil.bug_from_id(bd, args[0])
if len(args) == 1:
print bug.severity
diff --git a/becommands/show.py b/becommands/show.py
index ab1708f..7757aaa 100644
--- a/becommands/show.py
+++ b/becommands/show.py
@@ -22,7 +22,8 @@ import sys
from libbe import cmdutil, bugdir, comment, version, _version
__desc__ = __doc__
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import os
>>> bd = bugdir.SimpleBugDir()
@@ -66,7 +67,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
if len(args) == 0:
raise cmdutil.UsageError
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
if options.only_raw_body == True:
if len(args) != 1:
diff --git a/becommands/status.py b/becommands/status.py
index fd31c97..58b6f63 100644
--- a/becommands/status.py
+++ b/becommands/status.py
@@ -18,7 +18,8 @@
from libbe import cmdutil, bugdir, bug
__desc__ = __doc__
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import os
>>> bd = bugdir.SimpleBugDir()
@@ -39,7 +40,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
if len(args) not in (1,2):
raise cmdutil.UsageError
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
bug = cmdutil.bug_from_id(bd, args[0])
if len(args) == 1:
print bug.status
diff --git a/becommands/subscribe.py b/becommands/subscribe.py
index 19aac53..69554f7 100644
--- a/becommands/subscribe.py
+++ b/becommands/subscribe.py
@@ -20,7 +20,8 @@ __desc__ = __doc__
TAG="SUBSCRIBE:"
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> bd = bugdir.SimpleBugDir()
>>> bd.set_sync_with_disk(True)
@@ -73,7 +74,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
raise cmdutil.UsageError("Too many arguments.")
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
subscriber = options.subscriber
if subscriber == None:
diff --git a/becommands/tag.py b/becommands/tag.py
index e22cb70..f3819bd 100644
--- a/becommands/tag.py
+++ b/becommands/tag.py
@@ -19,7 +19,8 @@ from libbe import cmdutil, bugdir
import os, copy
__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 utility
>>> bd = bugdir.SimpleBugDir()
@@ -81,7 +82,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
raise cmdutil.UsageError("Too many arguments.")
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
if options.list:
bd.load_all_bugs()
tags = []
diff --git a/becommands/target.py b/becommands/target.py
index 9ccbacc..5dd5d38 100644
--- a/becommands/target.py
+++ b/becommands/target.py
@@ -23,7 +23,8 @@ from libbe import cmdutil, bugdir
from becommands import depend
__desc__ = __doc__
-def execute(args, manipulate_encodings=True, restrict_file_access=False):
+def execute(args, manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
"""
>>> import os, StringIO, sys
>>> bd = bugdir.SimpleBugDir()
@@ -60,7 +61,8 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
or (options.resolve == True and len(args) not in (0, 1)):
raise cmdutil.UsageError('Incorrect number of arguments.')
bd = bugdir.BugDir(from_disk=True,
- manipulate_encodings=manipulate_encodings)
+ manipulate_encodings=manipulate_encodings,
+ root=dir)
if options.resolve == True:
if len(args) == 0:
summary = None
diff --git a/libbe/cmdutil.py b/libbe/cmdutil.py
index b892bde..c567984 100644
--- a/libbe/cmdutil.py
+++ b/libbe/cmdutil.py
@@ -79,12 +79,15 @@ def get_command(command_name):
return cmd
-def execute(cmd, args, manipulate_encodings=True, restrict_file_access=False):
+def execute(cmd, args,
+ manipulate_encodings=True, restrict_file_access=False,
+ dir="."):
enc = encoding.get_encoding()
cmd = get_command(cmd)
ret = cmd.execute([a.decode(enc) for a in args],
manipulate_encodings=manipulate_encodings,
- restrict_file_access=restrict_file_access)
+ restrict_file_access=restrict_file_access,
+ dir=dir)
if ret == None:
ret = 0
return ret