mercurial/patch.py
changeset 11020 dd157720a8ee
parent 11019 4fe28bdc27be
child 11021 c47a1cfad572
equal deleted inserted replaced
11019:4fe28bdc27be 11020:dd157720a8ee
   345                 gp.oldpath = line[10:]
   345                 gp.oldpath = line[10:]
   346             elif line.startswith('copy to '):
   346             elif line.startswith('copy to '):
   347                 gp.path = line[8:]
   347                 gp.path = line[8:]
   348             elif line.startswith('deleted file'):
   348             elif line.startswith('deleted file'):
   349                 gp.op = 'DELETE'
   349                 gp.op = 'DELETE'
   350                 # is the deleted file a symlink?
       
   351                 gp.setmode(int(line[-6:], 8))
       
   352             elif line.startswith('new file mode '):
   350             elif line.startswith('new file mode '):
   353                 gp.op = 'ADD'
   351                 gp.op = 'ADD'
   354                 gp.setmode(int(line[-6:], 8))
   352                 gp.setmode(int(line[-6:], 8))
   355             elif line.startswith('new mode '):
   353             elif line.startswith('new mode '):
   356                 gp.setmode(int(line[-6:], 8))
   354                 gp.setmode(int(line[-6:], 8))
  1239             dst = repo.wjoin(gp.path)
  1237             dst = repo.wjoin(gp.path)
  1240             # patch won't create empty files
  1238             # patch won't create empty files
  1241             if gp.op == 'ADD' and not os.path.exists(dst):
  1239             if gp.op == 'ADD' and not os.path.exists(dst):
  1242                 flags = (isexec and 'x' or '') + (islink and 'l' or '')
  1240                 flags = (isexec and 'x' or '') + (islink and 'l' or '')
  1243                 repo.wwrite(gp.path, '', flags)
  1241                 repo.wwrite(gp.path, '', flags)
  1244             elif gp.op != 'DELETE':
  1242             util.set_flags(dst, islink, isexec)
  1245                 util.set_flags(dst, islink, isexec)
       
  1246     cmdutil.addremove(repo, cfiles, similarity=similarity)
  1243     cmdutil.addremove(repo, cfiles, similarity=similarity)
  1247     files = patches.keys()
  1244     files = patches.keys()
  1248     files.extend([r for r in removes if r not in files])
  1245     files.extend([r for r in removes if r not in files])
  1249     return sorted(files)
  1246     return sorted(files)
  1250 
  1247