[Pkg-bazaar-commits] ./bzr/unstable r550: - Refactor diff code into one that works purely on
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 08:19:14 UTC 2009
------------------------------------------------------------
revno: 550
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Wed 2005-05-25 12:48:22 +1200
message:
- Refactor diff code into one that works purely on
Tree objects
modified:
bzrlib/diff.py
-------------- next part --------------
=== modified file 'bzrlib/diff.py'
--- a/bzrlib/diff.py 2005-05-19 06:37:21 +0000
+++ b/bzrlib/diff.py 2005-05-25 00:48:22 +0000
@@ -65,6 +65,7 @@
print >>to_file
+
def show_diff(b, revision, specific_files):
import sys
@@ -75,6 +76,17 @@
new_tree = b.working_tree()
+ show_diff_trees(old_tree, new_tree, sys.stdout, specific_files)
+
+
+
+def show_diff_trees(old_tree, new_tree, to_file, specific_files=None):
+ """Show in text form the changes from one tree to another.
+
+ to_files
+ If set, include only changes to these files.
+ """
+
# TODO: Options to control putting on a prefix or suffix, perhaps as a format string
old_label = ''
new_label = ''
@@ -95,7 +107,7 @@
if kind == 'file':
_diff_one(old_tree.get_file(file_id).readlines(),
[],
- sys.stdout,
+ to_file,
fromfile=old_label + path,
tofile=DEVNULL)
@@ -104,7 +116,7 @@
if kind == 'file':
_diff_one([],
new_tree.get_file(file_id).readlines(),
- sys.stdout,
+ to_file,
fromfile=DEVNULL,
tofile=new_label + path)
@@ -113,7 +125,7 @@
if text_modified:
_diff_one(old_tree.get_file(file_id).readlines(),
new_tree.get_file(file_id).readlines(),
- sys.stdout,
+ to_file,
fromfile=old_label + old_path,
tofile=new_label + new_path)
@@ -122,7 +134,7 @@
if kind == 'file':
_diff_one(old_tree.get_file(file_id).readlines(),
new_tree.get_file(file_id).readlines(),
- sys.stdout,
+ to_file,
fromfile=old_label + path,
tofile=new_label + path)
More information about the Pkg-bazaar-commits
mailing list