# HG changeset patch # User Martin von Zweigbergk # Date 1416210104 28800 # Node ID 30b602168c3bb62de5afea8b97de9234e7394c3e # Parent 689540e6007e2868df72cae1a17ab8976b4c02c4 update: don't overwrite untracked ignored files on update When looking for untracked files that would conflict with a tracked file in the target revision (or the remote side of a merge), we explcitly exclude ignored files. The code was added in 7e30f5f2285f (merge: refactor unknown file conflict checking, 2012-02-09), but it seems like only unknown, not ignored, files were considered since the beginning of time. Although ignored files are mostly build outputs and backup files, we should still not overwrite them. Fix by simply removing the explicit check. diff -r 689540e6007e -r 30b602168c3b mercurial/merge.py --- a/mercurial/merge.py Tue Dec 02 17:11:01 2014 -0800 +++ b/mercurial/merge.py Sun Nov 16 23:41:44 2014 -0800 @@ -298,8 +298,7 @@ return r def _checkunknownfile(repo, wctx, mctx, f): - return (not repo.dirstate._ignore(f) - and os.path.isfile(repo.wjoin(f)) + return (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 -r 689540e6007e -r 30b602168c3b tests/test-up-local-change.t --- a/tests/test-up-local-change.t Tue Dec 02 17:11:01 2014 -0800 +++ b/tests/test-up-local-change.t Sun Nov 16 23:41:44 2014 -0800 @@ -231,8 +231,6 @@ test conflicting untracked ignored file -BROKEN: the ignored file gets overwritten by the remote version - $ hg up -qC 0 $ echo ignored > .hgignore $ hg add .hgignore @@ -246,9 +244,9 @@ $ echo untracked > ignored $ hg st $ hg up 'desc("add ignored file")' - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ cat ignored - ignored + ignored: untracked file differs + abort: untracked files in working directory differ from files in requested revision + [255] test a local add