mercurial/merge.py
changeset 3377 8c36b33a27c7
parent 3323 39fd6e82ea38
child 3387 ba7c74081861
equal deleted inserted replaced
3370:b7fe334ff4fb 3377:8c36b33a27c7
    85         if f not in man:
    85         if f not in man:
    86             action.append((f, "f"))
    86             action.append((f, "f"))
    87 
    87 
    88     return action
    88     return action
    89 
    89 
    90 def nonoverlap(d1, d2):
    90 def nonoverlap(d1, d2, d3):
    91     "Return list of elements in d1 not in d2"
    91     "Return list of elements in d1 not in d2 or d3"
    92 
    92 
    93     l = []
    93     l = []
    94     for d in d1:
    94     for d in d1:
    95         if d not in d2:
    95         if d not in d3 and d not in d2:
    96             l.append(d)
    96             l.append(d)
    97 
    97 
    98     l.sort()
    98     l.sort()
    99     return l
    99     return l
   100 
   100 
   114 
   114 
   115     old = old.keys()
   115     old = old.keys()
   116     old.sort()
   116     old.sort()
   117     return old
   117     return old
   118 
   118 
   119 def findcopies(repo, m1, m2, limit):
   119 def findcopies(repo, m1, m2, ma, limit):
   120     """
   120     """
   121     Find moves and copies between m1 and m2 back to limit linkrev
   121     Find moves and copies between m1 and m2 back to limit linkrev
   122     """
   122     """
   123 
   123 
   124     if not repo.ui.config("merge", "followcopies"):
   124     if not repo.ui.configbool("merge", "followcopies", True):
   125         return {}
   125         return {}
   126 
   126 
   127     # avoid silly behavior for update from empty dir
   127     # avoid silly behavior for update from empty dir
   128     if not m1:
   128     if not m1:
   129         return {}
   129         return {}
   130 
   130 
   131     dcopies = repo.dirstate.copies()
   131     dcopies = repo.dirstate.copies()
   132     copy = {}
   132     copy = {}
   133     match = {}
   133     match = {}
   134     u1 = nonoverlap(m1, m2)
   134     u1 = nonoverlap(m1, m2, ma)
   135     u2 = nonoverlap(m2, m1)
   135     u2 = nonoverlap(m2, m1, ma)
   136     ctx = util.cachefunc(lambda f,n: repo.filectx(f, fileid=n[:20]))
   136     ctx = util.cachefunc(lambda f,n: repo.filectx(f, fileid=n[:20]))
   137 
   137 
   138     def checkpair(c, f2, man):
   138     def checkpair(c, f2, man):
   139         ''' check if an apparent pair actually matches '''
   139         ''' check if an apparent pair actually matches '''
   140         c2 = ctx(f2, man[f2])
   140         c2 = ctx(f2, man[f2])
   192     def act(msg, m, f, *args):
   192     def act(msg, m, f, *args):
   193         repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m))
   193         repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m))
   194         action.append((f, m) + args)
   194         action.append((f, m) + args)
   195 
   195 
   196     if not (backwards or overwrite):
   196     if not (backwards or overwrite):
   197         copy = findcopies(repo, m1, m2, pa.rev())
   197         copy = findcopies(repo, m1, m2, ma, pa.rev())
   198 
   198 
   199     # Compare manifests
   199     # Compare manifests
   200     for f, n in m1.iteritems():
   200     for f, n in m1.iteritems():
   201         if partial and not partial(f):
   201         if partial and not partial(f):
   202             continue
   202             continue