diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -810,9 +810,9 @@ class queue: del wlock def pop(self, repo, patch=None, force=False, update=True, all=False): - def getfile(f, rev): + def getfile(f, rev, flags): t = repo.file(f).read(rev) - repo.wfile(f, "w").write(t) + repo.wwrite(f, t, flags) wlock = repo.wlock() try: @@ -870,10 +870,9 @@ class queue: if d: raise util.Abort("deletions found between repo revs") for f in m: - getfile(f, mmap[f]) + getfile(f, mmap[f], mmap.flags(f)) for f in r: - getfile(f, mmap[f]) - util.set_exec(repo.wjoin(f), mmap.execf(f)) + getfile(f, mmap[f], mmap.flags(f)) for f in m + r: repo.dirstate.normal(f) for f in a: diff --git a/tests/test-mq-symlinks b/tests/test-mq-symlinks new file mode 100755 --- /dev/null +++ b/tests/test-mq-symlinks @@ -0,0 +1,34 @@ +#!/bin/sh + +echo "[extensions]" >> $HGRCPATH +echo "mq=" >> $HGRCPATH + +cat >> readlink.py <', os.readlink(f) + except OSError, err: + if err.errno != errno.EINVAL: raise + print f, 'not a symlink' +EOF + +hg init +hg qinit +hg qnew base.patch +echo a > a +echo b > b +hg add a b +hg qrefresh +python readlink.py a + +hg qnew symlink.patch +rm a +ln -s b a +hg qrefresh --git +python readlink.py a + +hg qpop +hg qpush +python readlink.py a diff --git a/tests/test-mq-symlinks.out b/tests/test-mq-symlinks.out new file mode 100644 --- /dev/null +++ b/tests/test-mq-symlinks.out @@ -0,0 +1,6 @@ +a -> a not a symlink +a -> b +Now at: base.patch +applying symlink.patch +Now at: symlink.patch +a -> b