Handle BugDir.list_uuids() in the case of missing ".be/bugs/".
authorW. Trevor King <wking@drexel.edu>
Tue, 11 Aug 2009 18:46:26 +0000 (14:46 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 11 Aug 2009 18:46:26 +0000 (14:46 -0400)
Previously:
  $ be init
  $ be list
  ...
    File ".../libbe/bugdir.py", line 537, in list_uuids
      for uuid in os.listdir(self.get_path("bugs")):
  OSError: [Errno 2] No such file or directory: '.../.be/bugs'

libbe/bugdir.py

index 0eb4a6c8aa210f4a0ccd836f27db88f07a10015a..ee6c9437346bc192cccd85aaee92015f31f1b814 100644 (file)
@@ -534,10 +534,11 @@ settings easy.  Don't set this attribute.  Set .rcs instead, and
         uuids = []
         if self.sync_with_disk == True and os.path.exists(self.get_path()):
             # list the uuids on disk
-            for uuid in os.listdir(self.get_path("bugs")):
-                if not (uuid.startswith('.')):
-                    uuids.append(uuid)
-                    yield uuid
+            if os.path.exists(self.get_path("bugs")):
+                for uuid in os.listdir(self.get_path("bugs")):
+                    if not (uuid.startswith('.')):
+                        uuids.append(uuid)
+                        yield uuid
         # and the ones that are still just in memory
         for bug in self:
             if bug.uuid not in uuids: