Comments
Patch
@@ -9,7 +9,7 @@
from i18n import _
from mercurial import obsolete
import error, util, filemerge, copies, subrepo, worker, dicthelpers
-import errno, os, shutil
+import errno, os, shutil, stat
class mergestate(object):
'''track 3-way merge state of individual files'''
@@ -93,8 +93,16 @@
return r
def _checkunknownfile(repo, wctx, mctx, f):
+ try:
+ mode = repo.wvfs.lstat(f).st_mode
+ except OSError, err:
+ if err.errno not in (errno.ENOENT, errno.ENOTDIR):
+ raise
+ return False
+ if stat.S_ISDIR(mode):
+ return repo.dirstate.normalize(f) not in repo.dirstate.dirs()
+
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]))
@@ -247,6 +247,9 @@
def islink(self, path=None):
return os.path.islink(self.join(path))
+ def lstat(self, path=None):
+ return os.lstat(self.join(path))
+
def makedir(self, path=None, notindexed=True):
return util.makedir(self.join(path), notindexed)
@@ -173,4 +173,21 @@
$ hg revert -r -2 b
$ hg up -q -- -2
+test detecting collision between files in target context and unknown
+ones in working directory
+
+ $ hg update -q -C 1
+ $ hg manifest -r 1
+ a
+ b
+ $ hg manifest -r 3
+ a
+ b
+ c
+ $ mkdir c
+ $ hg update -q 3
+ c: untracked file differs
+ abort: untracked files in working directory differ from files in requested revision
+ [255]
+
$ cd ..