mercurial/merge.py
changeset 23639 35c724903157
parent 23638 09be050ca98c
child 23640 b46b9865dd08
equal deleted inserted replaced
23638:09be050ca98c 23639:35c724903157
   529 
   529 
   530 def _resolvetrivial(repo, wctx, mctx, ancestor, actions):
   530 def _resolvetrivial(repo, wctx, mctx, ancestor, actions):
   531     """Resolves false conflicts where the nodeid changed but the content
   531     """Resolves false conflicts where the nodeid changed but the content
   532        remained the same."""
   532        remained the same."""
   533 
   533 
   534     cdactions = []
   534     for f, (m, args, msg) in actions.items():
   535     for action in actions['cd']:
   535         if m == 'cd' and f in ancestor and not wctx[f].cmp(ancestor[f]):
   536         f = action[0]
       
   537         if f in ancestor and not wctx[f].cmp(ancestor[f]):
       
   538             # local did change but ended up with same content
   536             # local did change but ended up with same content
   539             actions['r'].append((f, None, "prompt same"))
   537             actions[f] = 'r', None, "prompt same"
   540         else:
   538         elif m == 'dc' and f in ancestor and not mctx[f].cmp(ancestor[f]):
   541             cdactions.append(action)
       
   542     actions['cd'] = cdactions
       
   543 
       
   544     dcactions = []
       
   545     for action in actions['dc']:
       
   546         f = action[0]
       
   547         if f in ancestor and not mctx[f].cmp(ancestor[f]):
       
   548             # remote did change but ended up with same content
   539             # remote did change but ended up with same content
   549             pass # don't get = keep local deleted
   540             del actions[f] # don't get = keep local deleted
   550         else:
       
   551             dcactions.append(action)
       
   552     actions['dc'] = dcactions
       
   553 
   541 
   554 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force, partial,
   542 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force, partial,
   555                      acceptremote, followcopies):
   543                      acceptremote, followcopies):
   556     "Calculate the actions needed to merge mctx into wctx using ancestors"
   544     "Calculate the actions needed to merge mctx into wctx using ancestors"
   557 
   545 
   625                          (f, m))
   613                          (f, m))
   626             actions[f] = l[0]
   614             actions[f] = l[0]
   627             continue
   615             continue
   628         repo.ui.note(_('end of auction\n\n'))
   616         repo.ui.note(_('end of auction\n\n'))
   629 
   617 
       
   618     _resolvetrivial(repo, wctx, mctx, ancestors[0], actions)
       
   619 
   630     # Convert to dictionary-of-lists format
   620     # Convert to dictionary-of-lists format
   631     actionbyfile = actions
   621     actionbyfile = actions
   632     actions = dict((m, []) for m in 'a f g cd dc r dm dg m e k'.split())
   622     actions = dict((m, []) for m in 'a f g cd dc r dm dg m e k'.split())
   633     for f, (m, args, msg) in actionbyfile.iteritems():
   623     for f, (m, args, msg) in actionbyfile.iteritems():
   634         actions[m].append((f, args, msg))
   624         actions[m].append((f, args, msg))
   635 
       
   636     _resolvetrivial(repo, wctx, mctx, ancestors[0], actions)
       
   637 
   625 
   638     if wctx.rev() is None:
   626     if wctx.rev() is None:
   639         ractions, factions = _forgetremoved(wctx, mctx, branchmerge)
   627         ractions, factions = _forgetremoved(wctx, mctx, branchmerge)
   640         actions['r'].extend(ractions)
   628         actions['r'].extend(ractions)
   641         actions['f'].extend(factions)
   629         actions['f'].extend(factions)