mercurial/patch.py
branchstable
changeset 10745 d94832c4a31d
parent 10736 a528a1046dba
child 10746 16b9aa398c28
child 10747 b010d899665e
equal deleted inserted replaced
10742:0e8403f4ce31 10745:d94832c4a31d
   931         goodb = not nullb and os.path.exists(bfile)
   931         goodb = not nullb and os.path.exists(bfile)
   932     createfunc = hunk.createfile
   932     createfunc = hunk.createfile
   933     missing = not goodb and not gooda and not createfunc()
   933     missing = not goodb and not gooda and not createfunc()
   934 
   934 
   935     # some diff programs apparently produce create patches where the
   935     # some diff programs apparently produce create patches where the
   936     # afile is not /dev/null, but rather the same name as the bfile
   936     # afile is not /dev/null, but afile starts with bfile
   937     if missing and afile == bfile:
   937     abasedir = afile[:afile.rfind('/') + 1]
       
   938     bbasedir = bfile[:bfile.rfind('/') + 1]
       
   939     if missing and abasedir == bbasedir and afile.startswith(bfile):
   938         # this isn't very pretty
   940         # this isn't very pretty
   939         hunk.create = True
   941         hunk.create = True
   940         if createfunc():
   942         if createfunc():
   941             missing = False
   943             missing = False
   942         else:
   944         else: