/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 bzrlib/diff.py

  • Committer: John Arbash Meinel
  • Date: 2007-03-22 19:54:30 UTC
  • mfrom: (2371 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2373.
  • Revision ID: john@arbash-meinel.com-20070322195430-wi92c7jpx17kiagr
[merge] bzr.dev 2371

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
    print >>to_file
97
97
 
98
98
 
99
 
def _set_lang_C():
100
 
    """Set the env vars LANG=C and LC_ALL=C."""
101
 
    osutils.set_or_unset_env('LANG', 'C')
102
 
    osutils.set_or_unset_env('LC_ALL', 'C')
103
 
    osutils.set_or_unset_env('LC_CTYPE', None)
104
 
    osutils.set_or_unset_env('LANGUAGE', None)
105
 
 
106
 
 
107
99
def _spawn_external_diff(diffcmd, capture_errors=True):
108
100
    """Spawn the externall diff process, and return the child handle.
109
101
 
114
106
    :return: A Popen object.
115
107
    """
116
108
    if capture_errors:
117
 
        if sys.platform == 'win32':
118
 
            # Win32 doesn't support preexec_fn, but that is
119
 
            # okay, because it doesn't support LANG and LC_ALL either.
120
 
            preexec_fn = None
121
 
        else:
122
 
            preexec_fn = _set_lang_C
 
109
        # construct minimal environment
 
110
        env = {}
 
111
        path = os.environ.get('PATH')
 
112
        if path is not None:
 
113
            env['PATH'] = path
 
114
        env['LANGUAGE'] = 'C'   # on win32 only LANGUAGE has effect
 
115
        env['LANG'] = 'C'
 
116
        env['LC_ALL'] = 'C'
123
117
        stderr = subprocess.PIPE
124
118
    else:
125
 
        preexec_fn = None
 
119
        env = None
126
120
        stderr = None
127
121
 
128
122
    try:
130
124
                                stdin=subprocess.PIPE,
131
125
                                stdout=subprocess.PIPE,
132
126
                                stderr=stderr,
133
 
                                preexec_fn=preexec_fn)
 
127
                                env=env)
134
128
    except OSError, e:
135
129
        if e.errno == errno.ENOENT:
136
130
            raise errors.NoDiff(str(e))