/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-02-18 01:57:45 UTC
  • mto: This revision was merged to the branch mainline in revision 7493.
  • Revision ID: jelmer@jelmer.uk-20200218015745-q2ss9tsk74h4nh61
drop use of future.

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' % (
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)
 
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)
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 or to_path,
766
 
                  self.new_label, to_path or from_path)
767
 
                 ).encode(self.path_encoding, 'replace'))
 
765
                 (self.old_label, from_path, self.new_label, to_path)).encode(self.path_encoding, 'replace'))
768
766
        return self.CHANGED
769
767
 
770
768
 
1054
1052
                    'supported on this filesystem.' % (change.path[0],))
1055
1053
                continue
1056
1054
            oldpath, newpath = change.path
1057
 
            oldpath_encoded = get_encoded_path(oldpath)
1058
 
            newpath_encoded = get_encoded_path(newpath)
 
1055
            oldpath_encoded = get_encoded_path(change.path[0])
 
1056
            newpath_encoded = get_encoded_path(change.path[1])
1059
1057
            old_present = (change.kind[0] is not None and change.versioned[0])
1060
1058
            new_present = (change.kind[1] is not None and change.versioned[1])
1061
1059
            executable = change.executable
1075
1073
            if (old_present, new_present) == (True, False):
1076
1074
                self.to_file.write(b"=== removed %s '%s'\n" %
1077
1075
                                   (kind[0].encode('ascii'), oldpath_encoded))
 
1076
                newpath = oldpath
1078
1077
            elif (old_present, new_present) == (False, True):
1079
1078
                self.to_file.write(b"=== added %s '%s'\n" %
1080
1079
                                   (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))