/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/diff.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-01 19:47:17 UTC
  • mfrom: (7506.1.1 merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20200601194717-8mco90rhp2v1dbgj
Merge lp:brz/3.1.

Merged from https://code.launchpad.net/~jelmer/brz/merge-3.1/+merge/384927

Show diffs side-by-side

added added

removed removed

Lines of Context:
731
731
            new_date = self.EPOCH_DATE
732
732
        else:
733
733
            return self.CANNOT_DIFF
734
 
        from_label = '%s%s\t%s' % (self.old_label, old_path,
735
 
                                   old_date)
736
 
        to_label = '%s%s\t%s' % (self.new_label, new_path,
737
 
                                 new_date)
 
734
        from_label = '%s%s\t%s' % (
 
735
            self.old_label, old_path or new_path, old_date)
 
736
        to_label = '%s%s\t%s' % (
 
737
            self.new_label, new_path or old_path, new_date)
738
738
        return self.diff_text(old_path, new_path, from_label, to_label)
739
739
 
740
740
    def diff_text(self, from_path, to_path, from_label, to_label):
762
762
        except errors.BinaryFile:
763
763
            self.to_file.write(
764
764
                ("Binary files %s%s and %s%s differ\n" %
765
 
                 (self.old_label, from_path, self.new_label, to_path)).encode(self.path_encoding, 'replace'))
 
765
                 (self.old_label, from_path or to_path,
 
766
                  self.new_label, to_path or from_path)
 
767
                 ).encode(self.path_encoding, 'replace'))
766
768
        return self.CHANGED
767
769
 
768
770
 
1052
1054
                    'supported on this filesystem.' % (change.path[0],))
1053
1055
                continue
1054
1056
            oldpath, newpath = change.path
1055
 
            oldpath_encoded = get_encoded_path(change.path[0])
1056
 
            newpath_encoded = get_encoded_path(change.path[1])
 
1057
            oldpath_encoded = get_encoded_path(oldpath)
 
1058
            newpath_encoded = get_encoded_path(newpath)
1057
1059
            old_present = (change.kind[0] is not None and change.versioned[0])
1058
1060
            new_present = (change.kind[1] is not None and change.versioned[1])
1059
1061
            executable = change.executable
1073
1075
            if (old_present, new_present) == (True, False):
1074
1076
                self.to_file.write(b"=== removed %s '%s'\n" %
1075
1077
                                   (kind[0].encode('ascii'), oldpath_encoded))
1076
 
                newpath = oldpath
1077
1078
            elif (old_present, new_present) == (False, True):
1078
1079
                self.to_file.write(b"=== added %s '%s'\n" %
1079
1080
                                   (kind[1].encode('ascii'), newpath_encoded))
1080
 
                oldpath = newpath
1081
1081
            elif renamed:
1082
1082
                self.to_file.write(b"=== renamed %s '%s' => '%s'%s\n" %
1083
1083
                                   (kind[0].encode('ascii'), oldpath_encoded, newpath_encoded, prop_str))