--- /dev/null
+> * 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.
+
--- /dev/null
+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
+
+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
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']).
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.
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()
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)
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()
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:
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
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()
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()
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
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
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."
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()
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
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()
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:
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()
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)
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
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:
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).
__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()
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,
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
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)
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
... 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()
>>> _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('/')
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
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="""
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
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()
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:
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()
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])
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
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:
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()
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"
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
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
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()
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()
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()
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
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()
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:
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()
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
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)
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:
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()
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 = []
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()
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
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