mercurial/merge.py
changeset 23395 d9ebb475eede
parent 23387 3eb99f8e9a62
child 23396 6a254a2dd37c
equal deleted inserted replaced
23394:b5e2128ce9e6 23395:d9ebb475eede
   413 
   413 
   414     for f, ((n1, fl1), (n2, fl2)) in diff.iteritems():
   414     for f, ((n1, fl1), (n2, fl2)) in diff.iteritems():
   415         if partial and not partial(f):
   415         if partial and not partial(f):
   416             continue
   416             continue
   417         if n1 and n2:
   417         if n1 and n2:
   418             fa = f
   418             if True:
   419             a = ma.get(f, nullid)
   419                 fa = f
   420             if a == nullid:
   420                 a = ma.get(f, nullid)
   421                 fa = copy.get(f, f)
   421                 if a == nullid:
   422                 # Note: f as default is wrong - we can't really make a 3-way
   422                     fa = copy.get(f, f)
   423                 # merge without an ancestor file.
   423                     # Note: f as default is wrong - we can't really make a 3-way
   424             fla = ma.flags(fa)
   424                     # merge without an ancestor file.
   425             nol = 'l' not in fl1 + fl2 + fla
   425                 fla = ma.flags(fa)
   426             if n2 == a and fl2 == fla:
   426                 nol = 'l' not in fl1 + fl2 + fla
   427                 actions['k'].append((f, (), "keep")) # remote unchanged
   427                 if n2 == a and fl2 == fla:
   428             elif n1 == a and fl1 == fla: # local unchanged - use remote
   428                     actions['k'].append((f, (), "keep")) # remote unchanged
   429                 if n1 == n2: # optimization: keep local content
   429                 elif n1 == a and fl1 == fla: # local unchanged - use remote
       
   430                     if n1 == n2: # optimization: keep local content
       
   431                         actions['e'].append((f, (fl2,), "update permissions"))
       
   432                     else:
       
   433                         actions['g'].append((f, (fl2,), "remote is newer"))
       
   434                 elif nol and n2 == a: # remote only changed 'x'
   430                     actions['e'].append((f, (fl2,), "update permissions"))
   435                     actions['e'].append((f, (fl2,), "update permissions"))
   431                 else:
   436                 elif nol and n1 == a: # local only changed 'x'
   432                     actions['g'].append((f, (fl2,), "remote is newer"))
   437                     actions['g'].append((f, (fl1,), "remote is newer"))
   433             elif nol and n2 == a: # remote only changed 'x'
   438                 else: # both changed something
   434                 actions['e'].append((f, (fl2,), "update permissions"))
   439                     actions['m'].append((f, (f, f, fa, False, pa.node()),
   435             elif nol and n1 == a: # local only changed 'x'
   440                                    "versions differ"))
   436                 actions['g'].append((f, (fl1,), "remote is newer"))
       
   437             else: # both changed something
       
   438                 actions['m'].append((f, (f, f, fa, False, pa.node()),
       
   439                                "versions differ"))
       
   440         elif f in copied: # files we'll deal with on m2 side
   441         elif f in copied: # files we'll deal with on m2 side
   441             pass
   442             pass
   442         elif n1 and f in movewithdir: # directory rename, move local
   443         elif n1 and f in movewithdir: # directory rename, move local
   443             f2 = movewithdir[f]
   444             f2 = movewithdir[f]
   444             actions['dm'].append((f2, (f, fl1),
   445             actions['dm'].append((f2, (f, fl1),