~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Vincent Ladeuil
  • Date: 2014-10-02 05:51:32 UTC
  • mto: This revision was merged to the branch mainline in revision 6601.
  • Revision ID: v.ladeuil+lp@free.fr-20141002055132-0argohc4fy69i51u
Remove duplication in cleanups. Note that --forward-ed is not in diff 3.3 and may need to be removed from the supported options.

Show diffs side-by-side

added added

removed removed

Lines of Context:
157
157
# diff style options as of GNU diff v3.2
158
158
style_option_list = ['-c', '-C', '--context',
159
159
                     '-e', '--ed',
160
 
                     '-f', '--forward-ed',
 
160
                     '-f', '--forward-ed', # Not in diff 3.3 ??
161
161
                     '-q', '--brief',
162
162
                     '--normal',
163
163
                     '-n', '--rcs',
286
286
    finally:
287
287
        oldtmpf.close()                 # and delete
288
288
        newtmpf.close()
289
 
        # Clean up. Warn in case the files couldn't be deleted
290
 
        # (in case windows still holds the file open, but not
291
 
        # if the files have already been deleted)
292
 
        try:
293
 
            os.remove(old_abspath)
294
 
        except OSError, e:
295
 
            if e.errno not in (errno.ENOENT,):
296
 
                warning('Failed to delete temporary file: %s %s',
297
 
                        old_abspath, e)
298
 
        try:
299
 
            os.remove(new_abspath)
300
 
        except OSError, e:
301
 
            if e.errno not in (errno.ENOENT,):
302
 
                warning('Failed to delete temporary file: %s %s',
303
 
                        new_abspath, e)
 
289
 
 
290
        def cleanup(path):
 
291
            # Warn in case the file couldn't be deleted (in case windows still
 
292
            # holds the file open, but not if the files have already been
 
293
            # deleted)
 
294
            try:
 
295
                os.remove(path)
 
296
            except OSError, e:
 
297
                if e.errno not in (errno.ENOENT,):
 
298
                    warning('Failed to delete temporary file: %s %s', path, e)
 
299
 
 
300
        cleanup(old_abspath)
 
301
        cleanup(new_abspath)
304
302
 
305
303
 
306
304
def get_trees_and_branches_to_diff_locked(