Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 5703:14789f30ac11
wwrite: simplify with util.set_flags
- always attempt to delete the file (gets rid of read-only message)
- always write as a normal file
- use set_flags to convert to link or set exec
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 27 Dec 2007 22:27:47 -0600 |
parents | 883d887c6408 |
children | f75ca1b0c81e |
line wrap: on
line diff
--- a/mercurial/localrepo.py Thu Dec 27 22:27:45 2007 -0600 +++ b/mercurial/localrepo.py Thu Dec 27 22:27:47 2007 -0600 @@ -505,16 +505,12 @@ def wwrite(self, filename, data, flags): data = self._filter("decode", filename, data) - if "l" in flags: - self.wopener.symlink(data, filename) - else: - try: - if self._link(filename): - os.unlink(self.wjoin(filename)) - except OSError: - pass - self.wopener(filename, 'w').write(data) - util.set_exec(self.wjoin(filename), "x" in flags) + try: + os.unlink(self.wjoin(filename)) + except OSError: + pass + self.wopener(filename, 'w').write(data) + util.set_flags(self.wjoin(filename), flags) def wwritedata(self, filename, data): return self._filter("decode", filename, data)