# HG changeset patch # User Siddharth Agarwal # Date 2013-05-08 21:11:01 # Node ID 113681bbef9e787eac56cf1d2049778a83ce124e # Parent 0b3689a08df53932db07fccfa59614e174e8ebae 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. diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -95,6 +95,7 @@ class mergestate(object): 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])) diff --git a/tests/test-symlinks.t b/tests/test-symlinks.t --- a/tests/test-symlinks.t +++ b/tests/test-symlinks.t @@ -160,6 +160,15 @@ now addremove should remove old files 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 ==