aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Bentley <abentley@panoramicfeedback.com>2005-03-14 22:09:06 +0000
committerAaron Bentley <abentley@panoramicfeedback.com>2005-03-14 22:09:06 +0000
commite2bbeeea8da29dbcbe523e2f5310a198b9bc71ce (patch)
tree8745875a5f9b5c211cd49a4002245bd8934362e7
parenta23c9c6cfbcc2bc77e6723edc4e059bca82fa924 (diff)
downloadbugseverywhere-e2bbeeea8da29dbcbe523e2f5310a198b9bc71ce.tar.gz
Initial implementation of saving to mapfile
-rw-r--r--becommands/open.py3
-rw-r--r--libbe/bugdir.py19
2 files changed, 20 insertions, 2 deletions
diff --git a/becommands/open.py b/becommands/open.py
index e6ff51e..bd0e4fa 100644
--- a/becommands/open.py
+++ b/becommands/open.py
@@ -2,4 +2,5 @@
from libbe import cmdutil
def execute(args):
assert(len(args) == 1)
- cmdutil.get_bug(args[0]).status = "open"
+ bug = cmdutil.get_bug(args[0])
+ bug.status = "open"
diff --git a/libbe/bugdir.py b/libbe/bugdir.py
index 9715011..31410d5 100644
--- a/libbe/bugdir.py
+++ b/libbe/bugdir.py
@@ -4,6 +4,7 @@ import cmdutil
import errno
import names
import rcs
+import mapfile
class NoBugDir(Exception):
def __init__(self, path):
@@ -106,5 +107,21 @@ class Bug(object):
rcs.unlink(self.get_path(name))
rcs.set_file_contents(self.get_path(name), "%s\n" % value)
+ def add_attr(self, map, name):
+ value = self.__getattribute__(name)
+ if value is not None:
+ map[name] = value
+
def save(self):
- pass
+ map = {}
+ self.add_attr(map, "summary")
+ self.add_attr(map, "creator")
+ self.add_attr(map, "target")
+ self.add_attr(map, "status")
+ self.add_attr(map, "severity")
+ path = self.get_path("values")
+ output = file(path, "wb")
+ if not os.path.exists(path):
+ rcs.add_id(path)
+ mapfile.generate(output, map)
+