1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 00:07:59 +01:00
Files
pentadactyl-pm/common/contrib/fix_symlinks.py
Kris Maglione 450a24340e Remove debugging statement from fix_symlinks script.
--HG--
extra : rebase_source : f6cb42e166a22df92f0be58795aa58d80b4eb34d
2010-10-14 12:07:09 -04:00

21 lines
640 B
Python

from mercurial import util
import os
def fix_symlinks(ui, repo, hooktype, parent1, **kwargs):
revert = hooktype in ('precommit', 'preupdate')
ctxt = repo[parent1]
for filename in ctxt:
file = ctxt[filename]
if 'l' in file.flags():
path = repo.wjoin(file.path())
try:
os.unlink(path)
except Exception, e:
print repr(e)
if revert:
repo.wwrite(file.path(), file.data(), '')
else:
target = os.path.join(os.path.dirname(path), file.data())
util.copyfiles(target, path, True)