mercurial/merge.py
changeset 4401 84cd52b48f94
parent 4400 93652499bed3
child 4404 47371e1c1db4
child 4416 bb1800a7d7e1
equal deleted inserted replaced
4400:93652499bed3 4401:84cd52b48f94
    99 
    99 
   100 def findcopies(repo, m1, m2, ma, limit):
   100 def findcopies(repo, m1, m2, ma, limit):
   101     """
   101     """
   102     Find moves and copies between m1 and m2 back to limit linkrev
   102     Find moves and copies between m1 and m2 back to limit linkrev
   103     """
   103     """
       
   104 
       
   105     def nonoverlap(d1, d2, d3):
       
   106         "Return list of elements in d1 not in d2 or d3"
       
   107         l = [d for d in d1 if d not in d3 and d not in d2]
       
   108         l.sort()
       
   109         return l
   104 
   110 
   105     def dirname(f):
   111     def dirname(f):
   106         s = f.rfind("/")
   112         s = f.rfind("/")
   107         if s == -1:
   113         if s == -1:
   108             return ""
   114             return ""
   137 
   143 
   138         old = old.keys()
   144         old = old.keys()
   139         old.sort()
   145         old.sort()
   140         return old
   146         return old
   141 
   147 
   142     def nonoverlap(d1, d2, d3):
   148     copy = {}
   143         "Return list of elements in d1 not in d2 or d3"
   149     fullcopy = {}
   144         l = [d for d in d1 if d not in d3 and d not in d2]
       
   145         l.sort()
       
   146         return l
       
   147 
   150 
   148     def checkcopies(c, man):
   151     def checkcopies(c, man):
   149         '''check possible copies for filectx c'''
   152         '''check possible copies for filectx c'''
   150         for of in findold(c):
   153         for of in findold(c):
   151             if of not in man: # original file not in other manifest?
   154             if of not in man: # original file not in other manifest?
   167     # avoid silly behavior for update from empty dir
   170     # avoid silly behavior for update from empty dir
   168     if not m1 or not m2 or not ma:
   171     if not m1 or not m2 or not ma:
   169         return {}
   172         return {}
   170 
   173 
   171     dcopies = repo.dirstate.copies()
   174     dcopies = repo.dirstate.copies()
   172     copy = {}
       
   173     fullcopy = {}
       
   174     u1 = nonoverlap(m1, m2, ma)
   175     u1 = nonoverlap(m1, m2, ma)
   175     u2 = nonoverlap(m2, m1, ma)
   176     u2 = nonoverlap(m2, m1, ma)
   176     ctx = util.cachefunc(lambda f, n: repo.filectx(f, fileid=n[:20]))
   177     ctx = util.cachefunc(lambda f, n: repo.filectx(f, fileid=n[:20]))
   177 
   178 
   178     for f in u1:
   179     for f in u1: