mercurial/merge.py
changeset 35288 5db3c748ce8f
parent 35284 1b03407e808d
child 35500 87918218da70
equal deleted inserted replaced
35287:3398603c5621 35288:5db3c748ce8f
   644                                   "('%s' is none of %s)")
   644                                   "('%s' is none of %s)")
   645                                 % (section, name, config, validstr))
   645                                 % (section, name, config, validstr))
   646     return config
   646     return config
   647 
   647 
   648 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
   648 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
       
   649     if wctx.isinmemory():
       
   650         # Nothing to do in IMM because nothing in the "working copy" can be an
       
   651         # unknown file.
       
   652         #
       
   653         # Note that we should bail out here, not in ``_checkunknownfiles()``,
       
   654         # because that function does other useful work.
       
   655         return False
       
   656 
   649     if f2 is None:
   657     if f2 is None:
   650         f2 = f
   658         f2 = f
   651     return (repo.wvfs.audit.check(f)
   659     return (repo.wvfs.audit.check(f)
   652         and repo.wvfs.isfileorlink(f)
   660         and repo.wvfs.isfileorlink(f)
   653         and repo.dirstate.normalize(f) not in repo.dirstate
   661         and repo.dirstate.normalize(f) not in repo.dirstate
   672         # A set of paths that are known to be absent.  This prevents repeated
   680         # A set of paths that are known to be absent.  This prevents repeated
   673         # checking of subdirectories that are known not to exist. It will be
   681         # checking of subdirectories that are known not to exist. It will be
   674         # updated with any new dirs that are checked and found to be absent.
   682         # updated with any new dirs that are checked and found to be absent.
   675         self._missingdircache = set()
   683         self._missingdircache = set()
   676 
   684 
   677     def __call__(self, repo, f):
   685     def __call__(self, repo, wctx, f):
       
   686         if wctx.isinmemory():
       
   687             # Nothing to do in IMM for the same reason as ``_checkunknownfile``.
       
   688             return False
       
   689 
   678         # Check for path prefixes that exist as unknown files.
   690         # Check for path prefixes that exist as unknown files.
   679         for p in reversed(list(util.finddirs(f))):
   691         for p in reversed(list(util.finddirs(f))):
   680             if p in self._missingdircache:
   692             if p in self._missingdircache:
   681                 return
   693                 return
   682             if p in self._unknowndircache:
   694             if p in self._unknowndircache:
   724         for f, (m, args, msg) in actions.iteritems():
   736         for f, (m, args, msg) in actions.iteritems():
   725             if m in ('c', 'dc'):
   737             if m in ('c', 'dc'):
   726                 if _checkunknownfile(repo, wctx, mctx, f):
   738                 if _checkunknownfile(repo, wctx, mctx, f):
   727                     fileconflicts.add(f)
   739                     fileconflicts.add(f)
   728                 elif pathconfig and f not in wctx:
   740                 elif pathconfig and f not in wctx:
   729                     path = checkunknowndirs(repo, f)
   741                     path = checkunknowndirs(repo, wctx, f)
   730                     if path is not None:
   742                     if path is not None:
   731                         pathconflicts.add(path)
   743                         pathconflicts.add(path)
   732             elif m == 'dg':
   744             elif m == 'dg':
   733                 if _checkunknownfile(repo, wctx, mctx, f, args[0]):
   745                 if _checkunknownfile(repo, wctx, mctx, f, args[0]):
   734                     fileconflicts.add(f)
   746                     fileconflicts.add(f)