update: don't overwrite untracked ignored files on update stable
authorMartin von Zweigbergk <martinvonz@google.com>
Sun, 16 Nov 2014 23:41:44 -0800
branchstable
changeset 23478 30b602168c3b
parent 23477 689540e6007e
child 23479 406dfc63a1ad
child 23500 9601229ed361
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.
mercurial/merge.py
tests/test-up-local-change.t
--- 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]))
--- 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