aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/init.py
diff options
context:
space:
mode:
authorChris Ball <cjb@laptop.org>2009-07-02 14:00:04 -0400
committerChris Ball <cjb@laptop.org>2009-07-02 14:00:04 -0400
commit64f62aa2bb841c483e8cb2b663434b3ad3038f4c (patch)
tree644cfa2fef611ad265d3116ac83026bf0181f7c1 /becommands/init.py
parent21a0bb0ae113ad9eaa6d94d36c8d0e5ca8508d7f (diff)
parenta536332660c8374e2000541e2db5ad6cea3b0e5e (diff)
downloadbugseverywhere-64f62aa2bb841c483e8cb2b663434b3ad3038f4c.tar.gz
Pull darcs fix, copyright updates from W. Trevor King
Diffstat (limited to 'becommands/init.py')
-rw-r--r--becommands/init.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/becommands/init.py b/becommands/init.py
index e3896e9..390dd15 100644
--- a/becommands/init.py
+++ b/becommands/init.py
@@ -1,4 +1,5 @@
-# Copyright (C) 2005 Aaron Bentley and Panometrics, Inc.
+# Copyright (C) 2005-2009 Aaron Bentley and Panometrics, Inc.
+# W. Trevor King <wking@drexel.edu>
# <abentley@panoramicfeedback.com>
#
# This program is free software; you can redistribute it and/or modify
@@ -29,7 +30,7 @@ def execute(args, test=False):
... except bugdir.NoBugDir, e:
... True
True
- >>> execute([dir.path], test=True)
+ >>> execute(['--root', dir.path], test=True)
No revision control detected.
Directory initialized.
>>> del(dir)
@@ -46,11 +47,11 @@ def execute(args, test=False):
>>> rcs.cleanup()
>>> try:
- ... execute(['.'], test=True)
+ ... execute(['--root', '.'], test=True)
... except cmdutil.UserError, e:
... str(e).startswith("Directory already initialized: ")
True
- >>> execute(['/highly-unlikely-to-exist'], test=True)
+ >>> execute(['--root', '/highly-unlikely-to-exist'], test=True)
Traceback (most recent call last):
UserError: No such directory: /highly-unlikely-to-exist
>>> os.chdir('/')
@@ -58,19 +59,17 @@ def execute(args, test=False):
parser = get_parser()
options, args = parser.parse_args(args)
cmdutil.default_complete(options, args, parser)
- if len(args) > 1:
+ if len(args) > 0:
raise cmdutil.UsageError
- if len(args) == 1:
- basedir = args[0]
- else:
- basedir = "."
try:
- bd = bugdir.BugDir(basedir, from_disk=False, sink_to_existing_root=False, assert_new_BugDir=True,
+ bd = bugdir.BugDir(options.root_dir, from_disk=False,
+ sink_to_existing_root=False,
+ assert_new_BugDir=True,
manipulate_encodings=not test)
except bugdir.NoRootEntry:
- raise cmdutil.UserError("No such directory: %s" % basedir)
+ raise cmdutil.UserError("No such directory: %s" % options.root_dir)
except bugdir.AlreadyInitialized:
- raise cmdutil.UserError("Directory already initialized: %s" % basedir)
+ raise cmdutil.UserError("Directory already initialized: %s" % options.root_dir)
bd.save()
if bd.rcs.name is not "None":
print "Using %s for revision control." % bd.rcs.name
@@ -79,7 +78,10 @@ def execute(args, test=False):
print "Directory initialized."
def get_parser():
- parser = cmdutil.CmdOptionParser("be init [DIRECTORY]")
+ 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,9 +92,9 @@ system. You can use "be set rcs_name" to change the rcs being used.
The directory defaults to your current working directory.
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 run "be init" in a subdirectory,
-then only bugs created in that subdirectory (and its children) will appear
-there.
+root, but you can put it anywhere. If you root Bugs Everywhere in a
+subdirectory, then only bugs created in that subdirectory (and its children)
+will appear there.
"""
def help():