mercurial/patch.py
changeset 9328 648d6a1a1cf2
parent 9248 ac02b43bc08a
child 9330 be2a13153372
equal deleted inserted replaced
9327:9a69ab6d7cf7 9328:648d6a1a1cf2
   791         goodb = not nullb and os.path.exists(bfile)
   791         goodb = not nullb and os.path.exists(bfile)
   792     createfunc = hunk.createfile
   792     createfunc = hunk.createfile
   793     if reverse:
   793     if reverse:
   794         createfunc = hunk.rmfile
   794         createfunc = hunk.rmfile
   795     missing = not goodb and not gooda and not createfunc()
   795     missing = not goodb and not gooda and not createfunc()
       
   796 
       
   797     # some diff programs apparently produce create patches where the
       
   798     # afile is not /dev/null, but rather the same name as the bfile
       
   799     if missing and afile == bfile:
       
   800         # this isn't very pretty
       
   801         hunk.create = True
       
   802         if createfunc():
       
   803             missing = False
       
   804         else:
       
   805             hunk.create = False
       
   806 
   796     # If afile is "a/b/foo" and bfile is "a/b/foo.orig" we assume the
   807     # If afile is "a/b/foo" and bfile is "a/b/foo.orig" we assume the
   797     # diff is between a file and its backup. In this case, the original
   808     # diff is between a file and its backup. In this case, the original
   798     # file should be patched (see original mpatch code).
   809     # file should be patched (see original mpatch code).
   799     isbackup = (abase == bbase and bfile.startswith(afile))
   810     isbackup = (abase == bbase and bfile.startswith(afile))
   800     fname = None
   811     fname = None