Mercurial > hg > mercurial-source
changeset 5707: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 | 1b914de8d0ba |
children | 5049bbf988e1 |
files | mercurial/localrepo.py tests/test-ro-message tests/test-ro-message.out |
diffstat | 3 files changed, 6 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -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)
deleted file mode 100755 --- a/tests/test-ro-message +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -HG=hg -"$HG" init -mkdir b -echo 'Bouncy' >b/bouncy -echo 'tricycle' >b/vehicle -"$HG" add b/bouncy -"$HG" add b/vehicle -"$HG" commit -m 'Adding bouncy' -echo 'bouncy' >>b/bouncy -"$HG" commit -m 'Making it bouncier' -"$HG" update -C 0 -echo 'stationary' >>b/vehicle -"$HG" commit -m 'Clarifying the vehicle.' -"$HG" update -C 1 -chmod a-w b/vehicle -"$HG" merge 2 2>&1 | sed 's|^\(.*[ ]\).*/\([^/]*/[^/]*/[^/]*\)$|\1\2|g'