aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/diff.py
diff options
context:
space:
mode:
Diffstat (limited to 'libbe/diff.py')
-rw-r--r--libbe/diff.py39
1 files changed, 21 insertions, 18 deletions
diff --git a/libbe/diff.py b/libbe/diff.py
index 86a91ca..17d6c50 100644
--- a/libbe/diff.py
+++ b/libbe/diff.py
@@ -15,9 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Compare two bug trees"""
-from libbe import cmdutil, bugdir
+from libbe import cmdutil, bugdir, bug
from libbe.utility import time_to_str
-from libbe.bug import cmp_severity
import doctest
def diff(old_bugdir, new_bugdir):
@@ -41,17 +40,18 @@ def diff(old_bugdir, new_bugdir):
def diff_report(diff_data, bug_dir):
(removed, modified, added) = diff_data
def modified_cmp(left, right):
- return cmp_severity(left[1], right[1])
+ return bug.cmp_severity(left[1], right[1])
- added.sort(cmp_severity)
- removed.sort(cmp_severity)
+ added.sort(bug.cmp_severity)
+ removed.sort(bug.cmp_severity)
modified.sort(modified_cmp)
-
+ lines = []
+
if len(added) > 0:
- print "New bug reports:"
- for bug in added:
- print bug.string(shortlist=True)
- print ""
+ lines.append("New bug reports:")
+ for bg in added:
+ lines.extend(bg.string(shortlist=True).splitlines())
+ lines.append("")
if len(modified) > 0:
printed = False
@@ -61,15 +61,18 @@ def diff_report(diff_data, bug_dir):
continue
if not printed:
printed = True
- print "Modified bug reports:"
- print change_str
- print ""
+ lines.append("Modified bug reports:")
+ lines.extend(change_str.splitlines())
+ if printed == True:
+ lines.append("")
- if len(removed) > 0:
- print "Removed bug reports:"
- for bug in removed:
- print bug.string(shortlist=True)
- print ""
+ if len(removed) > 0:
+ lines.append("Removed bug reports:")
+ for bg in removed:
+ lines.extend(bg.string(shortlist=True).splitlines())
+ lines.append("")
+
+ return '\n'.join(lines)
def change_lines(old, new, attributes):
change_list = []