mercurial/merge.py
changeset 45306 e7196f1da2b1
parent 45305 31c454a5f1a8
child 45307 00e9c5edcd58
equal deleted inserted replaced
45305:31c454a5f1a8 45306:e7196f1da2b1
   511         for p in invalidconflicts:
   511         for p in invalidconflicts:
   512             repo.ui.warn(_(b"%s: is both a file and a directory\n") % p)
   512             repo.ui.warn(_(b"%s: is both a file and a directory\n") % p)
   513         raise error.Abort(_(b"destination manifest contains path conflicts"))
   513         raise error.Abort(_(b"destination manifest contains path conflicts"))
   514 
   514 
   515 
   515 
   516 def _filternarrowactions(narrowmatch, branchmerge, actions):
   516 def _filternarrowactions(narrowmatch, branchmerge, mresult):
   517     """
   517     """
   518     Filters out actions that can ignored because the repo is narrowed.
   518     Filters out actions that can ignored because the repo is narrowed.
   519 
   519 
   520     Raise an exception if the merge cannot be completed because the repo is
   520     Raise an exception if the merge cannot be completed because the repo is
   521     narrowed.
   521     narrowed.
   522     """
   522     """
   523     nooptypes = {b'k'}  # TODO: handle with nonconflicttypes
   523     nooptypes = {b'k'}  # TODO: handle with nonconflicttypes
   524     nonconflicttypes = set(b'a am c cm f g gs r e'.split())
   524     nonconflicttypes = set(b'a am c cm f g gs r e'.split())
   525     # We mutate the items in the dict during iteration, so iterate
   525     # We mutate the items in the dict during iteration, so iterate
   526     # over a copy.
   526     # over a copy.
   527     for f, action in list(actions.items()):
   527     for f, action in list(mresult.actions.items()):
   528         if narrowmatch(f):
   528         if narrowmatch(f):
   529             pass
   529             pass
   530         elif not branchmerge:
   530         elif not branchmerge:
   531             del actions[f]  # just updating, ignore changes outside clone
   531             mresult.removefile(f)  # just updating, ignore changes outside clone
   532         elif action[0] in nooptypes:
   532         elif action[0] in nooptypes:
   533             del actions[f]  # merge does not affect file
   533             mresult.removefile(f)  # merge does not affect file
   534         elif action[0] in nonconflicttypes:
   534         elif action[0] in nonconflicttypes:
   535             raise error.Abort(
   535             raise error.Abort(
   536                 _(
   536                 _(
   537                     b'merge affects file \'%s\' outside narrow, '
   537                     b'merge affects file \'%s\' outside narrow, '
   538                     b'which is not yet supported'
   538                     b'which is not yet supported'
   948         checkpathconflicts(repo, wctx, p2, mresult)
   948         checkpathconflicts(repo, wctx, p2, mresult)
   949 
   949 
   950     narrowmatch = repo.narrowmatch()
   950     narrowmatch = repo.narrowmatch()
   951     if not narrowmatch.always():
   951     if not narrowmatch.always():
   952         # Updates "actions" in place
   952         # Updates "actions" in place
   953         _filternarrowactions(narrowmatch, branchmerge, mresult.actions)
   953         _filternarrowactions(narrowmatch, branchmerge, mresult)
   954 
   954 
   955     renamedelete = branch_copies1.renamedelete
   955     renamedelete = branch_copies1.renamedelete
   956     renamedelete.update(branch_copies2.renamedelete)
   956     renamedelete.update(branch_copies2.renamedelete)
   957 
   957 
   958     mresult.updatevalues(diverge, renamedelete, commitinfo)
   958     mresult.updatevalues(diverge, renamedelete, commitinfo)