comparison mercurial/merge.py @ 6271:01aed23355e9

merge: more simplifications to checkcopies
author Matt Mackall <mpm@selenic.com>
date Sat, 15 Mar 2008 10:02:31 -0500
parents 14f0fe2e2db7
children dd9bd227ae9a
comparison
equal deleted inserted replaced
6270:14f0fe2e2db7 6271:01aed23355e9
121 def checkcopies(f, m1, m2): 121 def checkcopies(f, m1, m2):
122 '''check possible copies of f from m1 to m2''' 122 '''check possible copies of f from m1 to m2'''
123 c1 = ctx(f, m1[f]) 123 c1 = ctx(f, m1[f])
124 for of in _findoldnames(c1, limit): 124 for of in _findoldnames(c1, limit):
125 fullcopy[f] = of # remember for dir rename detection 125 fullcopy[f] = of # remember for dir rename detection
126 if of not in m2: # original file not in other manifest? 126 if of in m2: # original file not in other manifest?
127 if of in ma: 127 # if the original file is unchanged on the other branch,
128 diverge.setdefault(of, []).append(f) 128 # no merge needed
129 continue 129 if m2[of] != ma.get(of):
130 # if the original file is unchanged on the other branch, 130 c2 = ctx(of, m2[of])
131 # no merge needed 131 ca = c1.ancestor(c2)
132 if m2[of] == ma.get(of): 132 # related and named changed on only one side?
133 continue 133 if ca and ca.path() == f or ca.path() == c2.path():
134 c2 = ctx(of, m2[of]) 134 if c1 != ca or c2 != ca: # merge needed?
135 ca = c1.ancestor(c2) 135 copy[f] = of
136 if not ca: # unrelated? 136 elif of in ma:
137 continue 137 diverge.setdefault(of, []).append(f)
138 # named changed on only one side?
139 if ca.path() == f or ca.path() == c2.path():
140 if c1 == ca and c2 == ca: # no merge needed, ignore copy
141 continue
142 copy[f] = of
143 138
144 if not repo.ui.configbool("merge", "followcopies", True): 139 if not repo.ui.configbool("merge", "followcopies", True):
145 return {}, {} 140 return {}, {}
146 141
147 # avoid silly behavior for update from empty dir 142 # avoid silly behavior for update from empty dir