Patch for bzr_difftools
Erik de Castro Lopo
erikd+bzr at mega-nerd.com
Sun Aug 13 13:36:14 BST 2006
Hi all,
I'm using Stephen Ward's bzr_difftools plugin:
http://mysite.verizon.net/sward.dev/projects/bzr_difftools/
and I've fixed a couple of deprecation warnings.
Patch below.
Cheers,
Erik
-------------------------8<-------------------------
=== modified file '__init__.py'
--- __init__.py 2006-05-12 02:57:01 +0000
+++ __init__.py 2006-08-13 12:27:27 +0000
@@ -38,11 +38,10 @@
from bzrlib.option import Option
from bzrlib.workingtree import WorkingTree
from bzrlib.branch import Branch
-from bzrlib.delta import compare_trees
from bzrlib.errors import (BzrError, BzrCommandError, NotVersionedError,
PathNotChild, FileInWrongBranch, NotLocalUrl,
NoWorkingTree)
-from bzrlib.osutils import appendpath, basename, getcwd, normpath, relpath
+from bzrlib.osutils import pathjoin, basename, getcwd, normpath, relpath
from bzrlib.export import export
from bzrlib.transport import get_transport
from bzrlib.transport.local import LocalTransport
@@ -196,14 +195,14 @@
new_hint = "-rev%d" % rev2.in_history(b1).revno
new_tmp_dir = NamedTemporaryDir(tmp_prefix, new_hint)
new_tmp_dir.write_stuff(new_tree, file_ids1, use_tree)
- new_path = appendpath(new_tmp_dir.path, adjust_path)
+ new_path = pathjoin(new_tmp_dir.path, adjust_path)
elif b2:
# Files from two different branches:
delta = get_diffs_or_stop(old_tree, work_tree2, file_ids2)
new_hint = '-' + b2.nick
new_tmp_dir = NamedTemporaryDir(tmp_prefix, new_hint)
new_tmp_dir.write_stuff(work_tree2, file_ids2, use_tree)
- new_path = appendpath(new_tmp_dir.path, adjust_path)
+ new_path = pathjoin(new_tmp_dir.path, adjust_path)
elif not in_working_tree:
# Repository branch or remote branch, but only one revision:
new_tree = b1.basis_tree()
@@ -211,7 +210,7 @@
new_hint = "-basis"
new_tmp_dir = NamedTemporaryDir(tmp_prefix, new_hint)
new_tmp_dir.write_stuff(new_tree, file_ids1, use_tree)
- new_path = appendpath(new_tmp_dir.path, adjust_path)
+ new_path = pathjoin(new_tmp_dir.path, adjust_path)
else:
# Item(s) in working tree, just diff it in place:
delta = get_diffs_or_stop(old_tree, work_tree1, file_ids1)
@@ -223,7 +222,7 @@
# No exceptions yet, so we really do need to extract the old version:
old_tmp_dir = NamedTemporaryDir(tmp_prefix, old_hint)
old_tmp_dir.write_stuff(old_tree, file_ids1, use_tree)
- old_path = appendpath(old_tmp_dir.path, adjust_path)
+ old_path = pathjoin(old_tmp_dir.path, adjust_path)
# Run the comparison:
if (tool.supports('recursive')):
@@ -313,7 +312,7 @@
for file_id in file_id_list
if new_tree.has_id(file_id)]
- delta = compare_trees(old_tree, new_tree, specific_files=path_list)
+ delta = new_tree.changes_from (old_tree, specific_files=path_list)
if ((len(delta.removed) + len(delta.added) +
len(delta.renamed) + len(delta.modified)) == 0):
raise NoDifferencesFound
=== modified file 'tempdir.py'
--- tempdir.py 2006-05-09 01:36:15 +0000
+++ tempdir.py 2006-06-28 08:47:36 +0000
@@ -6,7 +6,7 @@
from os import walk
from shutil import rmtree
-from bzrlib.osutils import (appendpath, basename, delete_any, make_readonly,
+from bzrlib.osutils import (pathjoin, basename, delete_any, make_readonly,
mkdtemp, pumpfile)
from bzrlib.export import export
from bzrlib.errors import BzrError
@@ -59,7 +59,7 @@
for file_id in file_id_list:
if rev_tree.has_id(file_id):
base_name = basename(rev_tree.id2path(file_id))
- tmp_file = open(appendpath(self.path, base_name), 'w')
+ tmp_file = open(pathjoin(self.path, base_name), 'w')
pumpfile(rev_tree.get_file(file_id), tmp_file)
tmp_file.close()
@@ -95,7 +95,7 @@
if self.readonly:
for (directory, subdirs, files) in walk(self.path):
for file in files:
- make_readonly(appendpath(directory, file))
+ make_readonly(pathjoin(directory, file))
return
-------------------------8<-------------------------
--
+-----------------------------------------------------------+
Erik de Castro Lopo
+-----------------------------------------------------------+
'Unix beats Windows' - says Microsoft!
http://blogs.zdnet.com/Murphy/index.php?p=459
More information about the bazaar
mailing list