aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/bug.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@tremily.us>2012-08-29 23:26:17 -0400
committerW. Trevor King <wking@tremily.us>2012-08-29 23:31:03 -0400
commit4db1a045a0606bead191a563abc54dfa8352efe0 (patch)
tree51c891d731555340ffd4432cd889fb67795ae1b6 /libbe/bug.py
parent5a32d82284e54facf2f5dcb03ba37afe3805a609 (diff)
downloadbugseverywhere-4db1a045a0606bead191a563abc54dfa8352efe0.tar.gz
Rewrite commands to use bugdirs instead of a single bugdir.
The bulk of the work is in regard to XML, with new BugDir.xml and .from_xml methods to support the new <bugdir> entity. I also split the guts import_xml's ._run method into sub-methods to make the import logic more obvious.
Diffstat (limited to 'libbe/bug.py')
-rw-r--r--libbe/bug.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/libbe/bug.py b/libbe/bug.py
index 07f09e4..8b81842 100644
--- a/libbe/bug.py
+++ b/libbe/bug.py
@@ -700,20 +700,21 @@ class Bug (settings_object.SavedSettingsObject):
</comment>
</bug>
"""
- for attr in other.explicit_attrs:
- old = getattr(self, attr)
- new = getattr(other, attr)
- if old != new:
- if accept_changes == True:
- setattr(self, attr, new)
- elif change_exception == True:
- raise ValueError, \
- 'Merge would change %s "%s"->"%s" for bug %s' \
- % (attr, old, new, self.uuid)
+ if hasattr(other, 'explicit_attrs'):
+ for attr in other.explicit_attrs:
+ old = getattr(self, attr)
+ new = getattr(other, attr)
+ if old != new:
+ if accept_changes:
+ setattr(self, attr, new)
+ elif change_exception:
+ raise ValueError(
+ ('Merge would change {} "{}"->"{}" for bug {}'
+ ).format(attr, old, new, self.uuid))
for estr in other.extra_strings:
if not estr in self.extra_strings:
if accept_extra_strings == True:
- self.extra_strings.append(estr)
+ self.extra_strings += [estr]
elif change_exception == True:
raise ValueError, \
'Merge would add extra string "%s" for bug %s' \