comparison mercurial/commands.py @ 2942:f4fc0575e8fa

merge with brendan.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Fri, 18 Aug 2006 13:01:40 -0700
parents 0843bd53dcff 439fd013360d
children 731f6b3d27c2
comparison
equal deleted inserted replaced
2932:d77022db1bca 2942:f4fc0575e8fa
1679 # launch the editor 1679 # launch the editor
1680 message = None 1680 message = None
1681 ui.debug(_('message:\n%s\n') % message) 1681 ui.debug(_('message:\n%s\n') % message)
1682 1682
1683 files, fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root) 1683 files, fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root)
1684 removes = [] 1684 files = patch.updatedir(ui, repo, files, wlock=wlock)
1685 if len(files) > 0:
1686 cfiles = files.keys()
1687 copies = []
1688 copts = {'after': False, 'force': False}
1689 cwd = repo.getcwd()
1690 if cwd:
1691 cfiles = [util.pathto(cwd, f) for f in files.keys()]
1692 for f in files:
1693 ctype, gp = files[f]
1694 if ctype == 'RENAME':
1695 copies.append((gp.oldpath, gp.path, gp.copymod))
1696 removes.append(gp.oldpath)
1697 elif ctype == 'COPY':
1698 copies.append((gp.oldpath, gp.path, gp.copymod))
1699 elif ctype == 'DELETE':
1700 removes.append(gp.path)
1701 for src, dst, after in copies:
1702 absdst = os.path.join(repo.root, dst)
1703 if not after and os.path.exists(absdst):
1704 raise util.Abort(_('patch creates existing file %s') % dst)
1705 if cwd:
1706 src, dst = [util.pathto(cwd, f) for f in (src, dst)]
1707 copts['after'] = after
1708 errs, copied = docopy(ui, repo, (src, dst), copts, wlock=wlock)
1709 if errs:
1710 raise util.Abort(errs)
1711 if removes:
1712 repo.remove(removes, True, wlock=wlock)
1713 for f in files:
1714 ctype, gp = files[f]
1715 if gp and gp.mode:
1716 x = gp.mode & 0100 != 0
1717 dst = os.path.join(repo.root, gp.path)
1718 util.set_exec(dst, x)
1719 cmdutil.addremove(repo, cfiles, wlock=wlock)
1720 files = files.keys()
1721 files.extend([r for r in removes if r not in files])
1722 repo.commit(files, message, user, date, wlock=wlock, lock=lock) 1685 repo.commit(files, message, user, date, wlock=wlock, lock=lock)
1723 finally: 1686 finally:
1724 os.unlink(tmpname) 1687 os.unlink(tmpname)
1725 1688
1726 def incoming(ui, repo, source="default", **opts): 1689 def incoming(ui, repo, source="default", **opts):