manifestmerge: local unknown, remote created: don't traverse symlinks
To figure out what to do with locally unknown files, Mercurial attempts to read
them if they exist. When an attempt is made to read a file that exists but
traverses a symlink, Mercurial aborts.
With this patch, we first ensure that the file doesn't traverse a symlink
before opening it. This is fine because a file being "remote created" means the
symlink doesn't exist remotely, which means it will be deleted in the apply
phase.
--- a/mercurial/merge.py Thu Apr 04 13:45:21 2013 -0700
+++ b/mercurial/merge.py Wed May 08 14:11:01 2013 -0700
@@ -95,6 +95,7 @@
def _checkunknownfile(repo, wctx, mctx, f):
return (not repo.dirstate._ignore(f)
and os.path.isfile(repo.wjoin(f))
+ and repo.wopener.audit.check(f)
and repo.dirstate.normalize(f) not in repo.dirstate
and mctx[f].cmp(wctx[f]))
--- a/tests/test-symlinks.t Thu Apr 04 13:45:21 2013 -0700
+++ b/tests/test-symlinks.t Wed May 08 14:11:01 2013 -0700
@@ -160,6 +160,15 @@
adding bar/a
adding foo
removing foo/a
+
+commit and update back
+
+ $ hg ci -mb
+ $ hg up '.^'
+ 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ $ hg up tip
+ 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
$ cd ..
== root of repository is symlinked ==