Don't necessarily initialize a new VCS in BugDir.load_settings().
authorW. Trevor King <wking@drexel.edu>
Fri, 4 Dec 2009 03:05:23 +0000 (22:05 -0500)
committerW. Trevor King <wking@drexel.edu>
Fri, 4 Dec 2009 03:05:23 +0000 (22:05 -0500)
We may already have the right type, in which case, don't mess with it.
This speeds up bugdir loading a bit more:
  $ time be list > /dev/null

  real    0m1.245s
  user    0m1.116s
  sys     0m0.124s

libbe/bugdir.py

index d78e761728ddb34d83f684a6a89785026bdb0086..70051815d731e60d6d387ee96616b849692b2e9c 100644 (file)
@@ -413,8 +413,9 @@ settings easy.  Don't set this attribute.  Set .vcs instead, and
         self._setup_encoding(self.encoding)
         self._setup_severities(self.severities)
         self._setup_status(self.active_status, self.inactive_status)
-        self.vcs = vcs.vcs_by_name(self.vcs_name)
-        self._setup_user_id(self.user_id)
+        if self.vcs_name != self.vcs.name:
+            self.vcs = vcs.vcs_by_name(self.vcs_name)
+            self._setup_user_id(self.user_id)
 
     def save_settings(self):
         settings = self._get_saved_settings()