mercurial/patch.py
changeset 12345 e0ee3e822a9a
parent 12266 00658492e2aa
parent 12344 b6173aee4a47
child 12577 05210e955bef
equal deleted inserted replaced
12323:f00953d9533c 12345:e0ee3e822a9a
    23 
    23 
    24 # helper functions
    24 # helper functions
    25 
    25 
    26 def copyfile(src, dst, basedir):
    26 def copyfile(src, dst, basedir):
    27     abssrc, absdst = [util.canonpath(basedir, basedir, x) for x in [src, dst]]
    27     abssrc, absdst = [util.canonpath(basedir, basedir, x) for x in [src, dst]]
    28     if os.path.exists(absdst):
    28     if os.path.lexists(absdst):
    29         raise util.Abort(_("cannot create %s: destination already exists") %
    29         raise util.Abort(_("cannot create %s: destination already exists") %
    30                          dst)
    30                          dst)
    31 
    31 
    32     dstdir = os.path.dirname(absdst)
    32     dstdir = os.path.dirname(absdst)
    33     if dstdir and not os.path.isdir(dstdir):
    33     if dstdir and not os.path.isdir(dstdir):
   921     gooda = not nulla and os.path.lexists(afile)
   921     gooda = not nulla and os.path.lexists(afile)
   922     bbase, bfile = pathstrip(bfile_orig, strip)
   922     bbase, bfile = pathstrip(bfile_orig, strip)
   923     if afile == bfile:
   923     if afile == bfile:
   924         goodb = gooda
   924         goodb = gooda
   925     else:
   925     else:
   926         goodb = not nullb and os.path.exists(bfile)
   926         goodb = not nullb and os.path.lexists(bfile)
   927     createfunc = hunk.createfile
   927     createfunc = hunk.createfile
   928     missing = not goodb and not gooda and not createfunc()
   928     missing = not goodb and not gooda and not createfunc()
   929 
   929 
   930     # some diff programs apparently produce patches where the afile is
   930     # some diff programs apparently produce patches where the afile is
   931     # not /dev/null, but afile starts with bfile
   931     # not /dev/null, but afile starts with bfile