comparison mercurial/copies.py @ 30196:d738cda70894

copies: make it possible to distinguish betwen _computenonoverlap invocations _computenonoverlap needs to be invoked twice during a graft, and debugging messages should be distinguishable between the two invocations
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 18 Oct 2016 00:00:43 +0200
parents 88626de195f8
children 0accd5a5ad04
comparison
equal deleted inserted replaced
30195:88626de195f8 30196:d738cda70894
229 if a == y: 229 if a == y:
230 return _backwardrenames(x, y) 230 return _backwardrenames(x, y)
231 return _chain(x, y, _backwardrenames(x, a), 231 return _chain(x, y, _backwardrenames(x, a),
232 _forwardcopies(a, y, match=match)) 232 _forwardcopies(a, y, match=match))
233 233
234 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2): 234 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, baselabel=''):
235 """Computes, based on addedinm1 and addedinm2, the files exclusive to c1 235 """Computes, based on addedinm1 and addedinm2, the files exclusive to c1
236 and c2. This is its own function so extensions can easily wrap this call 236 and c2. This is its own function so extensions can easily wrap this call
237 to see what files mergecopies is about to process. 237 to see what files mergecopies is about to process.
238 238
239 Even though c1 and c2 are not used in this function, they are useful in 239 Even though c1 and c2 are not used in this function, they are useful in
240 other extensions for being able to read the file nodes of the changed files. 240 other extensions for being able to read the file nodes of the changed files.
241
242 "baselabel" can be passed to help distinguish the multiple computations
243 done in the graft case.
241 """ 244 """
242 u1 = sorted(addedinm1 - addedinm2) 245 u1 = sorted(addedinm1 - addedinm2)
243 u2 = sorted(addedinm2 - addedinm1) 246 u2 = sorted(addedinm2 - addedinm1)
244 247
248 header = " unmatched files in %s"
249 if baselabel:
250 header += ' (from %s)' % baselabel
245 if u1: 251 if u1:
246 repo.ui.debug(" unmatched files in local:\n %s\n" 252 repo.ui.debug("%s:\n %s\n" % (header % 'local', "\n ".join(u1)))
247 % "\n ".join(u1))
248 if u2: 253 if u2:
249 repo.ui.debug(" unmatched files in other:\n %s\n" 254 repo.ui.debug("%s:\n %s\n" % (header % 'other', "\n ".join(u2)))
250 % "\n ".join(u2))
251 return u1, u2 255 return u1, u2
252 256
253 def _makegetfctx(ctx): 257 def _makegetfctx(ctx):
254 """return a 'getfctx' function suitable for _checkcopies usage 258 """return a 'getfctx' function suitable for _checkcopies usage
255 259