Kiln » Kiln Storage Service Read More
Clone URL:  
nobinary.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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