~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-31 18:58:11 UTC
  • mto: (1900.2.1 bzr.merge.54651)
  • mto: This revision was merged to the branch mainline in revision 1903.
  • Revision ID: john@arbash-meinel.com-20060731185811-a9976f50e047fc03
Just swallow a return code of 2

Show diffs side-by-side

added added

removed removed

Lines of Context:
175
175
            bzrlib.osutils.pumpfile(pipe.stdout, to_file)
176
176
        rc = pipe.wait()
177
177
        
178
 
        if rc != 0 and rc != 1:
 
178
        # TODO: jam 20060731 'diff' returns exit code '2' if binary 
 
179
        #       files differ. But it also returns '2' if a file you
 
180
        #       are comparing doesn't exist, etc.
 
181
        #       'info diff' says:
 
182
        #         "An exit status of 0 means no differences were found, 
 
183
        #         1 means some differences were found, and 2 means trouble."
 
184
        #       If we assume we do things correctly, we can assume '2' means
 
185
        #       'Binary files .* differ'
 
186
        #       Alternatively, we could read the output of diff, and look
 
187
        #       for the "Binary files .* differ" line, but that would mean
 
188
        #       we always need to buffer the diff output.
 
189
        if rc not in (0, 1, 2):
179
190
            # returns 1 if files differ; that's OK
180
191
            if rc < 0:
181
192
                msg = 'signal %d' % (-rc)
182
193
            else:
183
194
                msg = 'exit code %d' % rc
184
195
                
185
 
            raise BzrError('external diff failed with %s; command: %r' % (rc, diffcmd))
 
196
            raise BzrError('external diff failed with %s; command: %r' 
 
197
                           % (rc, diffcmd))
186
198
    finally:
187
199
        oldtmpf.close()                 # and delete
188
200
        newtmpf.close()