aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
authorAaron Bentley <abentley@panoramicfeedback.com>2005-05-18 19:19:39 +0000
committerAaron Bentley <abentley@panoramicfeedback.com>2005-05-18 19:19:39 +0000
commita39937baf1196099eeee198169d55b9b498e9651 (patch)
tree1a63e499aaf00b579d91070994bbd137acea03ac /libbe
parent53f5cced06f25dc49cedf1a3fb181201b727a521 (diff)
downloadbugseverywhere-a39937baf1196099eeee198169d55b9b498e9651.tar.gz
Better errors for bad bug roots
Diffstat (limited to 'libbe')
-rw-r--r--libbe/bugdir.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/libbe/bugdir.py b/libbe/bugdir.py
index ea6384d..8856db4 100644
--- a/libbe/bugdir.py
+++ b/libbe/bugdir.py
@@ -60,9 +60,25 @@ def set_version(path, rcs):
TREE_VERSION_STRING = "Bugs Everywhere Tree 1 0\n"
+class NoRootEntry(Exception):
+ def __init__(self, path):
+ self.path = path
+ Exception.__init__(self, "Specified root does not exist: %s" % path)
+
def create_bug_dir(path, rcs):
+ """
+ >>> import no_rcs
+ >>> create_bug_dir('/highly-unlikely-to-exist', no_rcs)
+ Traceback (most recent call last):
+ NoRootEntry: Specified root does not exist: /highly-unlikely-to-exist
+ """
root = os.path.join(path, ".be")
- rcs.mkdir(root)
+ try:
+ rcs.mkdir(root)
+ except OSError, e:
+ if e.errno != errno.ENOENT:
+ raise
+ raise NoRootEntry(path)
rcs.mkdir(os.path.join(root, "bugs"))
set_version(root, rcs)
map_save(rcs, os.path.join(root, "settings"), {"rcs_name": rcs.name})