import os
from mercurial.util import binary
def reposetup(ui, repo):
if not repo.local():
return
class nobinaryrepo(repo.__class__):
def wwrite(self, filename, data, flags):
if binary(data):
# From mercurial.localrepo.wwrite
try:
os.unlink(self.wjoin(filename))
except OSError:
pass
# /From mercurial.localrepo.wwrite
# We need the file to exist, though. Otherwise the dirstate is broken.
self.wopener(filename, 'w').write('')
return
return super(nobinaryrepo, self).wwrite(filename, data, flags)
repo.__class__ = nobinaryrepo
|
Loading...