/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/mergetools.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-16 23:19:12 UTC
  • mfrom: (7180 work)
  • mto: This revision was merged to the branch mainline in revision 7294.
  • Revision ID: jelmer@jelmer.uk-20181116231912-e043vpq22bdkxa6q
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
                    for s in os.getenv('PATHEXT', '').split(os.pathsep)]
57
57
        return os.path.exists(exe) and ext in path_ext
58
58
    else:
59
 
        return (os.access(exe, os.X_OK)
60
 
                or osutils.find_executable_on_path(exe) is not None)
 
59
        return (os.access(exe, os.X_OK) or
 
60
                osutils.find_executable_on_path(exe) is not None)
61
61
 
62
62
 
63
63
def invoke(command_line, filename, invoker=None):
73
73
    if exe is not None:
74
74
        cmd_list[0] = exe
75
75
    args, tmp_file = _subst_filename(cmd_list, filename)
 
76
 
76
77
    def cleanup(retcode):
77
78
        if tmp_file is not None:
78
 
            if retcode == 0: # on success, replace file with temp file
 
79
            if retcode == 0:  # on success, replace file with temp file
79
80
                shutil.move(tmp_file, filename)
80
 
            else: # otherwise, delete temp file
 
81
            else:  # otherwise, delete temp file
81
82
                os.remove(tmp_file)
82
83
    return invoker(args[0], args[1:], cleanup)
83
84
 
98
99
    tmp_file = None
99
100
    subst_args = []
100
101
    for arg in args:
101
 
        if '{this_temp}' in arg and not 'this_temp' in subst_names:
 
102
        if '{this_temp}' in arg and 'this_temp' not in subst_names:
102
103
            fh, tmp_file = tempfile.mkstemp(u"_bzr_mergetools_%s.THIS" %
103
104
                                            os.path.basename(filename))
104
105
            trace.mutter('fh=%r, tmp_file=%r', fh, tmp_file)