/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: 2018-02-18 19:18:40 UTC
  • mto: This revision was merged to the branch mainline in revision 6928.
  • Revision ID: jelmer@jelmer.uk-20180218191840-2wezg20u9ffbfmed
Fix more bees, use with rather than try/finally for some files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
816
816
                raise
817
817
        source = tree.get_file(relpath, file_id)
818
818
        try:
819
 
            target = open(full_path, 'wb')
820
 
            try:
 
819
            with open(full_path, 'wb') as target:
821
820
                osutils.pumpfile(source, target)
822
 
            finally:
823
 
                target.close()
824
821
        finally:
825
822
            source.close()
826
823
        try:
871
868
                file_id=file_id)
872
869
        command = self._get_command(old_abs_path, new_abs_path)
873
870
        subprocess.call(command, cwd=self._root)
874
 
        new_file = open(new_abs_path, 'rb')
875
 
        try:
 
871
        with open(new_abs_path, 'rb') as new_file:
876
872
            return new_file.read()
877
 
        finally:
878
 
            new_file.close()
879
873
 
880
874
 
881
875
class DiffTree(object):