mercurial/merge.py
changeset 49910 7b474609f199
parent 49909 b7cf91ef03ba
child 49911 c7a04bfabd4d
equal deleted inserted replaced
49909:b7cf91ef03ba 49910:7b474609f199
    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, dircache, wctx, mctx, f, f2=None):
    49 def _checkunknownfile(dirstate, wvfs, 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.isfileorlink_checkdir(dircache, f)
    61         wvfs.isfileorlink_checkdir(dircache, f)
    62         and repo.dirstate.normalize(f) not in repo.dirstate
    62         and dirstate.normalize(f) not in dirstate
    63         and mctx[f2].cmp(wctx[f])
    63         and mctx[f2].cmp(wctx[f])
    64     )
    64     )
    65 
    65 
    66 
    66 
    67 class _unknowndirschecker:
    67 class _unknowndirschecker:
   134     ignoredconfig = _getcheckunknownconfig(repo, b'merge', b'checkignored')
   134     ignoredconfig = _getcheckunknownconfig(repo, b'merge', b'checkignored')
   135     pathconfig = repo.ui.configbool(
   135     pathconfig = repo.ui.configbool(
   136         b'experimental', b'merge.checkpathconflicts'
   136         b'experimental', b'merge.checkpathconflicts'
   137     )
   137     )
   138     dircache = dict()
   138     dircache = dict()
       
   139     dirstate = repo.dirstate
       
   140     wvfs = repo.wvfs
   139     if not force:
   141     if not force:
   140 
   142 
   141         def collectconflicts(conflicts, config):
   143         def collectconflicts(conflicts, config):
   142             if config == b'abort':
   144             if config == b'abort':
   143                 abortconflicts.update(conflicts)
   145                 abortconflicts.update(conflicts)
   149             (
   151             (
   150                 mergestatemod.ACTION_CREATED,
   152                 mergestatemod.ACTION_CREATED,
   151                 mergestatemod.ACTION_DELETED_CHANGED,
   153                 mergestatemod.ACTION_DELETED_CHANGED,
   152             )
   154             )
   153         ):
   155         ):
   154             if _checkunknownfile(repo, dircache, wctx, mctx, f):
   156             if _checkunknownfile(dirstate, wvfs, dircache, wctx, mctx, f):
   155                 fileconflicts.add(f)
   157                 fileconflicts.add(f)
   156             elif pathconfig and f not in wctx:
   158             elif pathconfig and f not in wctx:
   157                 path = checkunknowndirs(repo, wctx, f)
   159                 path = checkunknowndirs(repo, wctx, f)
   158                 if path is not None:
   160                 if path is not None:
   159                     pathconflicts.add(path)
   161                     pathconflicts.add(path)
   160         for f, args, msg in mresult.getactions(
   162         for f, args, msg in mresult.getactions(
   161             [mergestatemod.ACTION_LOCAL_DIR_RENAME_GET]
   163             [mergestatemod.ACTION_LOCAL_DIR_RENAME_GET]
   162         ):
   164         ):
   163             if _checkunknownfile(repo, wctx, mctx, f, args[0]):
   165             if _checkunknownfile(
       
   166                 dirstate, wvfs, dircache, wctx, mctx, f, args[0]
       
   167             ):
   164                 fileconflicts.add(f)
   168                 fileconflicts.add(f)
   165 
   169 
   166         allconflicts = fileconflicts | pathconflicts
   170         allconflicts = fileconflicts | pathconflicts
   167         ignoredconflicts = {c for c in allconflicts if repo.dirstate._ignore(c)}
   171         ignoredconflicts = {c for c in allconflicts if repo.dirstate._ignore(c)}
   168         unknownconflicts = allconflicts - ignoredconflicts
   172         unknownconflicts = allconflicts - ignoredconflicts
   171     else:
   175     else:
   172         for f, args, msg in list(
   176         for f, args, msg in list(
   173             mresult.getactions([mergestatemod.ACTION_CREATED_MERGE])
   177             mresult.getactions([mergestatemod.ACTION_CREATED_MERGE])
   174         ):
   178         ):
   175             fl2, anc = args
   179             fl2, anc = args
   176             different = _checkunknownfile(repo, wctx, mctx, f)
   180             different = _checkunknownfile(
       
   181                 dirstate, wvfs, dircache, wctx, mctx, f
       
   182             )
   177             if repo.dirstate._ignore(f):
   183             if repo.dirstate._ignore(f):
   178                 config = ignoredconfig
   184                 config = ignoredconfig
   179             else:
   185             else:
   180                 config = unknownconfig
   186                 config = unknownconfig
   181 
   187