/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: Jelmer Vernooij
  • Date: 2020-06-15 01:29:36 UTC
  • mfrom: (7490.40.4 work)
  • mto: (7490.40.19 work)
  • mto: This revision was merged to the branch mainline in revision 7516.
  • Revision ID: jelmer@jelmer.uk-20200615012936-1adqbu592y7lzmy8
Merge upstream.

Show diffs side-by-side

added added

removed removed

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