mercurial/commands.py
changeset 2933 439fd013360d
parent 2922 773c5b82d052
child 2942 f4fc0575e8fa
equal deleted inserted replaced
2926:13cd2cdeff6a 2933:439fd013360d
  1681                 # launch the editor
  1681                 # launch the editor
  1682                 message = None
  1682                 message = None
  1683             ui.debug(_('message:\n%s\n') % message)
  1683             ui.debug(_('message:\n%s\n') % message)
  1684 
  1684 
  1685             files, fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root)
  1685             files, fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root)
  1686             removes = []
  1686             files = patch.updatedir(ui, repo, files, wlock=wlock)
  1687             if len(files) > 0:
       
  1688                 cfiles = files.keys()
       
  1689                 copies = []
       
  1690                 copts = {'after': False, 'force': False}
       
  1691                 cwd = repo.getcwd()
       
  1692                 if cwd:
       
  1693                     cfiles = [util.pathto(cwd, f) for f in files.keys()]
       
  1694                 for f in files:
       
  1695                     ctype, gp = files[f]
       
  1696                     if ctype == 'RENAME':
       
  1697                         copies.append((gp.oldpath, gp.path, gp.copymod))
       
  1698                         removes.append(gp.oldpath)
       
  1699                     elif ctype == 'COPY':
       
  1700                         copies.append((gp.oldpath, gp.path, gp.copymod))
       
  1701                     elif ctype == 'DELETE':
       
  1702                         removes.append(gp.path)
       
  1703                 for src, dst, after in copies:
       
  1704                     absdst = os.path.join(repo.root, dst)
       
  1705                     if not after and os.path.exists(absdst):
       
  1706                         raise util.Abort(_('patch creates existing file %s') % dst)
       
  1707                     if cwd:
       
  1708                         src, dst = [util.pathto(cwd, f) for f in (src, dst)]
       
  1709                     copts['after'] = after
       
  1710                     errs, copied = docopy(ui, repo, (src, dst), copts, wlock=wlock)
       
  1711                     if errs:
       
  1712                         raise util.Abort(errs)
       
  1713                 if removes:
       
  1714                     repo.remove(removes, True, wlock=wlock)
       
  1715                 for f in files:
       
  1716                     ctype, gp = files[f]
       
  1717                     if gp and gp.mode:
       
  1718                         x = gp.mode & 0100 != 0
       
  1719                         dst = os.path.join(repo.root, gp.path)
       
  1720                         util.set_exec(dst, x)
       
  1721                 cmdutil.addremove(repo, cfiles, wlock=wlock)
       
  1722             files = files.keys()
       
  1723             files.extend([r for r in removes if r not in files])
       
  1724             repo.commit(files, message, user, date, wlock=wlock, lock=lock)
  1687             repo.commit(files, message, user, date, wlock=wlock, lock=lock)
  1725         finally:
  1688         finally:
  1726             os.unlink(tmpname)
  1689             os.unlink(tmpname)
  1727 
  1690 
  1728 def incoming(ui, repo, source="default", **opts):
  1691 def incoming(ui, repo, source="default", **opts):