mercurial/merge.py
changeset 49909 b7cf91ef03ba
parent 49892 c7624b1ac8b4
child 49910 7b474609f199
equal deleted inserted replaced
49908:789e152a6bdb 49909:b7cf91ef03ba
    44         msg %= (section, name, config, validstr)
    44         msg %= (section, name, config, validstr)
    45         raise error.ConfigError(msg)
    45         raise error.ConfigError(msg)
    46     return config
    46     return config
    47 
    47 
    48 
    48 
    49 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
    49 def _checkunknownfile(repo, dircache, wctx, mctx, f, f2=None):
    50     if wctx.isinmemory():
    50     if wctx.isinmemory():
    51         # Nothing to do in IMM because nothing in the "working copy" can be an
    51         # Nothing to do in IMM because nothing in the "working copy" can be an
    52         # unknown file.
    52         # unknown file.
    53         #
    53         #
    54         # Note that we should bail out here, not in ``_checkunknownfiles()``,
    54         # Note that we should bail out here, not in ``_checkunknownfiles()``,
    56         return False
    56         return False
    57 
    57 
    58     if f2 is None:
    58     if f2 is None:
    59         f2 = f
    59         f2 = f
    60     return (
    60     return (
    61         repo.wvfs.audit.check(f)
    61         repo.wvfs.isfileorlink_checkdir(dircache, f)
    62         and repo.wvfs.isfileorlink(f)
       
    63         and repo.dirstate.normalize(f) not in repo.dirstate
    62         and repo.dirstate.normalize(f) not in repo.dirstate
    64         and mctx[f2].cmp(wctx[f])
    63         and mctx[f2].cmp(wctx[f])
    65     )
    64     )
    66 
    65 
    67 
    66 
   134     unknownconfig = _getcheckunknownconfig(repo, b'merge', b'checkunknown')
   133     unknownconfig = _getcheckunknownconfig(repo, b'merge', b'checkunknown')
   135     ignoredconfig = _getcheckunknownconfig(repo, b'merge', b'checkignored')
   134     ignoredconfig = _getcheckunknownconfig(repo, b'merge', b'checkignored')
   136     pathconfig = repo.ui.configbool(
   135     pathconfig = repo.ui.configbool(
   137         b'experimental', b'merge.checkpathconflicts'
   136         b'experimental', b'merge.checkpathconflicts'
   138     )
   137     )
       
   138     dircache = dict()
   139     if not force:
   139     if not force:
   140 
   140 
   141         def collectconflicts(conflicts, config):
   141         def collectconflicts(conflicts, config):
   142             if config == b'abort':
   142             if config == b'abort':
   143                 abortconflicts.update(conflicts)
   143                 abortconflicts.update(conflicts)
   144             elif config == b'warn':
   144             elif config == b'warn':
   145                 warnconflicts.update(conflicts)
   145                 warnconflicts.update(conflicts)
   146 
   146 
   147         checkunknowndirs = _unknowndirschecker()
   147         checkunknowndirs = _unknowndirschecker()
   148         with repo.wvfs.audit.cached():
   148         for f in mresult.files(
   149             for f in mresult.files(
   149             (
   150                 (
   150                 mergestatemod.ACTION_CREATED,
   151                     mergestatemod.ACTION_CREATED,
   151                 mergestatemod.ACTION_DELETED_CHANGED,
   152                     mergestatemod.ACTION_DELETED_CHANGED,
   152             )
   153                 )
   153         ):
   154             ):
   154             if _checkunknownfile(repo, dircache, wctx, mctx, f):
   155                 if _checkunknownfile(repo, wctx, mctx, f):
   155                 fileconflicts.add(f)
   156                     fileconflicts.add(f)
   156             elif pathconfig and f not in wctx:
   157                 elif pathconfig and f not in wctx:
   157                 path = checkunknowndirs(repo, wctx, f)
   158                     path = checkunknowndirs(repo, wctx, f)
   158                 if path is not None:
   159                     if path is not None:
   159                     pathconflicts.add(path)
   160                         pathconflicts.add(path)
       
   161         for f, args, msg in mresult.getactions(
   160         for f, args, msg in mresult.getactions(
   162             [mergestatemod.ACTION_LOCAL_DIR_RENAME_GET]
   161             [mergestatemod.ACTION_LOCAL_DIR_RENAME_GET]
   163         ):
   162         ):
   164             if _checkunknownfile(repo, wctx, mctx, f, args[0]):
   163             if _checkunknownfile(repo, wctx, mctx, f, args[0]):
   165                 fileconflicts.add(f)
   164                 fileconflicts.add(f)