1069 |
1069 |
1070 if invalidconflicts: |
1070 if invalidconflicts: |
1071 for p in invalidconflicts: |
1071 for p in invalidconflicts: |
1072 repo.ui.warn(_("%s: is both a file and a directory\n") % p) |
1072 repo.ui.warn(_("%s: is both a file and a directory\n") % p) |
1073 raise error.Abort(_("destination manifest contains path conflicts")) |
1073 raise error.Abort(_("destination manifest contains path conflicts")) |
|
1074 |
|
1075 def _filternarrowactions(narrowmatch, branchmerge, actions): |
|
1076 """ |
|
1077 Filters out actions that can ignored because the repo is narrowed. |
|
1078 |
|
1079 Raise an exception if the merge cannot be completed because the repo is |
|
1080 narrowed. |
|
1081 """ |
|
1082 nooptypes = set(['k']) # TODO: handle with nonconflicttypes |
|
1083 nonconflicttypes = set('a am c cm f g r e'.split()) |
|
1084 # We mutate the items in the dict during iteration, so iterate |
|
1085 # over a copy. |
|
1086 for f, action in list(actions.items()): |
|
1087 if narrowmatch(f): |
|
1088 pass |
|
1089 elif not branchmerge: |
|
1090 del actions[f] # just updating, ignore changes outside clone |
|
1091 elif action[0] in nooptypes: |
|
1092 del actions[f] # merge does not affect file |
|
1093 elif action[0] in nonconflicttypes: |
|
1094 raise error.Abort(_('merge affects file \'%s\' outside narrow, ' |
|
1095 'which is not yet supported') % f, |
|
1096 hint=_('merging in the other direction ' |
|
1097 'may work')) |
|
1098 else: |
|
1099 raise error.Abort(_('conflict in file \'%s\' is outside ' |
|
1100 'narrow clone') % f) |
1074 |
1101 |
1075 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, matcher, |
1102 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, matcher, |
1076 acceptremote, followcopies, forcefulldiff=False): |
1103 acceptremote, followcopies, forcefulldiff=False): |
1077 """ |
1104 """ |
1078 Merge wctx and p2 with ancestor pa and generate merge action list |
1105 Merge wctx and p2 with ancestor pa and generate merge action list |
1254 |
1281 |
1255 if repo.ui.configbool('experimental', 'merge.checkpathconflicts'): |
1282 if repo.ui.configbool('experimental', 'merge.checkpathconflicts'): |
1256 # If we are merging, look for path conflicts. |
1283 # If we are merging, look for path conflicts. |
1257 checkpathconflicts(repo, wctx, p2, actions) |
1284 checkpathconflicts(repo, wctx, p2, actions) |
1258 |
1285 |
|
1286 narrowmatch = repo.narrowmatch() |
|
1287 if not narrowmatch.always(): |
|
1288 # Updates "actions" in place |
|
1289 _filternarrowactions(narrowmatch, branchmerge, actions) |
|
1290 |
1259 return actions, diverge, renamedelete |
1291 return actions, diverge, renamedelete |
1260 |
1292 |
1261 def _resolvetrivial(repo, wctx, mctx, ancestor, actions): |
1293 def _resolvetrivial(repo, wctx, mctx, ancestor, actions): |
1262 """Resolves false conflicts where the nodeid changed but the content |
1294 """Resolves false conflicts where the nodeid changed but the content |
1263 remained the same.""" |
1295 remained the same.""" |