[PATCH] more windows patches: diff output
Fredrik Lundh
fredrik at pythonware.com
Sat Apr 16 10:25:33 BST 2005
this patch fixes the diff output, so diffs generated on windows can be
applied on other platforms.
(if the selftest patch is accepted too, the "path" function should pro-
bably be renamed and moved to osutils)
enjoy! /F
--- bzrlib/commands.py.bak Sat Apr 16 11:18:52 2005
+++ bzrlib/commands.py Sat Apr 16 11:18:59 2005
@@ -86,6 +86,10 @@
NONE_STRING = '(none)'
EMPTY = 'empty'
+def path(s):
+ # helper to "normalize" path names
+ return s.replace(os.sep, '/')
+
## TODO: Perhaps a different version of inventory commands that
## returns iterators...
@@ -404,32 +408,33 @@
if file_state in ['.', '?', 'I']:
continue
elif file_state == 'A':
- print '*** added %s %r' % (kind, new_name)
+ print '*** added %s %r' % (kind, path(new_name))
if kind == 'file':
diffit([],
new_tree.get_file(fid).readlines(),
fromfile=DEVNULL,
- tofile=new_label + new_name + idlabel)
+ tofile=path(new_label + new_name + idlabel))
elif file_state == 'D':
assert isinstance(old_name, types.StringTypes)
print '*** deleted %s %r' % (kind, old_name)
if kind == 'file':
diffit(old_tree.get_file(fid).readlines(), [],
- fromfile=old_label + old_name + idlabel,
+ fromfile=path(old_label + old_name + idlabel),
tofile=DEVNULL)
elif file_state in ['M', 'R']:
if file_state == 'M':
assert kind == 'file'
assert old_name == new_name
- print '*** modified %s %r' % (kind, new_name)
+ print '*** modified %s %r' % (kind, path(new_name))
elif file_state == 'R':
- print '*** renamed %s %r => %r' % (kind, old_name, new_name)
+ print '*** renamed %s %r => %r' % (kind, path(old_name),
+ path(new_name))
if kind == 'file':
diffit(old_tree.get_file(fid).readlines(),
new_tree.get_file(fid).readlines(),
- fromfile=old_label + old_name + idlabel,
- tofile=new_label + new_name)
+ fromfile=path(old_label + old_name + idlabel),
+ tofile=path(new_label + new_name))
else:
bailout("can't represent state %s {%s}" % (file_state, fid))
More information about the bazaar
mailing list