[MERGE] Diff now emits files in alphabetical order

Andrew Bennetts andrew at canonical.com
Wed Dec 19 10:18:38 GMT 2007


bb:tweak

Just one comment:

Aaron Bentley wrote:
[...]
> +        for (file_id, paths, changed_content, versioned, parent, name, kind,
> +             executable) in sorted(iterator, key=changes_key):
> +            oldpath_encoded = get_encoded_path(paths[0])
> +            newpath_encoded = get_encoded_path(paths[1])
> +            old_present = (kind[0] is not None and versioned[0])
> +            new_present = (kind[1] is not None and versioned[1])
> +            renamed = (parent[0], name[0]) != (parent[1], name[1])
> +            prop_str = get_prop_change(executable[0] != executable[1])
> +            if (old_present, new_present) == (True, False):
> +                self.to_file.write("=== removed %s '%s'\n" %
> +                                   (kind[0], oldpath_encoded))
> +            elif (old_present, new_present) == (False, True):
> +                self.to_file.write("=== added %s '%s'\n" %
> +                                   (kind[1], newpath_encoded))
> +            elif renamed:
> +                self.to_file.write("=== renamed %s '%s' => '%s'%s\n" %
> +                    (kind[0], oldpath_encoded, newpath_encoded, prop_str))
> +            elif changed_content:
> +                self.to_file.write("=== modified %s '%s'%s\n" % (kind[0],
> +                                   newpath_encoded, prop_str))

Should there be an “else: raise AssertionError('unknown change')” here,
just in case?  Or are there changes that this routine is expected to ignore?

A comment either way would be good.

-Andrew.




More information about the bazaar mailing list