equal
deleted
inserted
replaced
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 dirname(f): |
|
106 s = f.rfind("/") |
|
107 if s == -1: |
|
108 return "" |
|
109 return f[:s] |
|
110 |
|
111 def dirs(files): |
|
112 d = {} |
|
113 for f in files: |
|
114 f = dirname(f) |
|
115 while f not in d: |
|
116 d[f] = True |
|
117 f = dirname(f) |
|
118 return d |
104 |
119 |
105 def findold(fctx): |
120 def findold(fctx): |
106 "find files that path was copied from, back to linkrev limit" |
121 "find files that path was copied from, back to linkrev limit" |
107 old = {} |
122 old = {} |
108 seen = {} |
123 seen = {} |
144 fullcopy[c.path()] = of # remember for dir rename detection |
159 fullcopy[c.path()] = of # remember for dir rename detection |
145 if c == ca and c2 == ca: # no merge needed, ignore copy |
160 if c == ca and c2 == ca: # no merge needed, ignore copy |
146 continue |
161 continue |
147 copy[c.path()] = of |
162 copy[c.path()] = of |
148 |
163 |
149 def dirs(files): |
|
150 d = {} |
|
151 for f in files: |
|
152 d[os.path.dirname(f)] = True |
|
153 return d |
|
154 |
|
155 if not repo.ui.configbool("merge", "followcopies", True): |
164 if not repo.ui.configbool("merge", "followcopies", True): |
156 return {} |
165 return {} |
157 |
166 |
158 # avoid silly behavior for update from empty dir |
167 # avoid silly behavior for update from empty dir |
159 if not m1 or not m2 or not ma: |
168 if not m1 or not m2 or not ma: |
181 dirmove = {} |
190 dirmove = {} |
182 |
191 |
183 # examine each file copy for a potential directory move, which is |
192 # examine each file copy for a potential directory move, which is |
184 # when all the files in a directory are moved to a new directory |
193 # when all the files in a directory are moved to a new directory |
185 for dst, src in fullcopy.items(): |
194 for dst, src in fullcopy.items(): |
186 dsrc, ddst = os.path.dirname(src), os.path.dirname(dst) |
195 dsrc, ddst = dirname(src), dirname(dst) |
187 if dsrc in invalid: |
196 if dsrc in invalid: |
188 # already seen to be uninteresting |
197 # already seen to be uninteresting |
189 continue |
198 continue |
190 elif dsrc in d1 and ddst in d1: |
199 elif dsrc in d1 and ddst in d1: |
191 # directory wasn't entirely moved locally |
200 # directory wasn't entirely moved locally |