Initial implementation of saving to mapfile
authorAaron Bentley <abentley@panoramicfeedback.com>
Mon, 14 Mar 2005 22:09:06 +0000 (22:09 +0000)
committerAaron Bentley <abentley@panoramicfeedback.com>
Mon, 14 Mar 2005 22:09:06 +0000 (22:09 +0000)
becommands/open.py
libbe/bugdir.py

index e6ff51e5c0dff00303652902996c0ccfd243af25..bd0e4faf725227a96c64e365e255e6d8db8e9e2b 100644 (file)
@@ -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"
index 97150116bd87cfbdf93d7b8a6a5923261f48dc89..31410d5e47d805f96411a883f65b81f431cb0eac 100644 (file)
@@ -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)
+