diff options
-rw-r--r-- | .be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/values | 2 | ||||
-rw-r--r-- | .be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values | 2 | ||||
-rw-r--r-- | libbe/bugdir.py | 35 |
3 files changed, 21 insertions, 18 deletions
diff --git a/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/values b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/values index 5ee35f9..c80f16e 100644 --- a/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/values +++ b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/values @@ -15,7 +15,7 @@ severity=minor -status=open +status=fixed diff --git a/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values index 9992d72..5aed729 100644 --- a/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values +++ b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values @@ -15,7 +15,7 @@ severity=minor -status=open +status=fixed diff --git a/libbe/bugdir.py b/libbe/bugdir.py index 8c96cc6..2501a27 100644 --- a/libbe/bugdir.py +++ b/libbe/bugdir.py @@ -168,6 +168,8 @@ class BugDir (list): _user_id = setting_property("user-id", doc="The user's prefered name. Kept seperate to make saving/loading settings easy. Don't set this attribute. Set .user_id instead, and ._user_id will be automatically adjusted. This setting is only saved if ._save_user_id == True") def _get_user_id(self): + if self._user_id == None and self.rcs != None: + self._user_id = self.rcs.get_user_id() return self._user_id def _set_user_id(self, user_id): @@ -181,7 +183,7 @@ class BugDir (list): def save_user_id(self, user_id=None): if user_id == None: - user_id = self.rcs.get_user_id() + user_id = self.user_id self._save_user_id = True self.user_id = user_id @@ -215,10 +217,8 @@ class BugDir (list): self.settings = self._get_settings(self.get_path("settings")) self.rcs = rcs_by_name(self.rcs_name) - if self.user_id != None: # there was a user name in the settings file - self._save_user_id = True - else: - self.user_id = self.rcs.get_user_id() + if self._user_id != None: # there was a user name in the settings file + self.save_user_id() self._clear_bugs() for uuid in self.list_uuids(): @@ -242,17 +242,19 @@ class BugDir (list): return settings def _save_settings(self, settings_path, settings): - if not os.path.exists(self.get_path()): - # don't save settings until the bug directory has been - # initialized. this initialization happens the first time - # a bug directory is saved (BugDir.save()). If the user - # is just working with a BugDir in memory, we don't want - # to go cluttering up his file system with settings files. - return - if self._save_user_id == False and settings == self.settings: - if "user-id" in settings: - settings = copy.copy(settings) - del settings["user-id"] + this_dir_path = os.path.realpath(self.get_path("settings")) + if os.path.realpath(settings_path) == this_dir_path: + if not os.path.exists(self.get_path()): + # don't save settings until the bug directory has been + # initialized. this initialization happens the first time + # a bug directory is saved (BugDir.save()). If the user + # is just working with a BugDir in memory, we don't want + # to go cluttering up his file system with settings files. + return + if self._save_user_id == False: + if "user-id" in settings: + settings = copy.copy(settings) + del settings["user-id"] try: mapfile.map_save(self.rcs, settings_path, settings) except PathNotInRoot, e: @@ -269,6 +271,7 @@ class BugDir (list): duplicate_settings = self._get_settings(duplicate_settings_path) if "rcs_name" in duplicate_settings: duplicate_settings["rcs_name"] = "None" + duplicate_settings["user-id"] = self.user_id self._save_settings(duplicate_settings_path, duplicate_settings) return BugDir(duplicate_path, loadNow=True) |