~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2006-12-21 03:59:43 UTC
  • mfrom: (2206 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2207.
  • Revision ID: mbp@sourcefrog.net-20061221035943-2qazd36lrxms0bug
merge bzr.dev, reconcile with option changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
214
214
            replace - put in a bogus character (typically '?')
215
215
            exact - do not encode sys.stdout
216
216
 
 
217
            NOTE: by default on Windows, sys.stdout is opened as a text
 
218
            stream, therefore LF line-endings are converted to CRLF.
 
219
            When a command uses encoding_type = 'exact', then
 
220
            sys.stdout is forced to be a binary stream, and line-endings
 
221
            will not mangled.
 
222
 
217
223
    """
218
224
    aliases = []
219
225
    takes_args = []
246
252
        # Originally I was using self.stdout, but that looks
247
253
        # *way* too much like sys.stdout
248
254
        if self.encoding_type == 'exact':
 
255
            # force sys.stdout to be binary stream on win32
 
256
            if sys.platform == 'win32':
 
257
                fileno = getattr(sys.stdout, 'fileno', None)
 
258
                if fileno:
 
259
                    import msvcrt
 
260
                    msvcrt.setmode(fileno(), os.O_BINARY)
249
261
            self.outf = sys.stdout
250
262
            return
251
263