##// END OF EJS Templates
copies: rename ctx() to getfctx() for clarity
Matt Mackall -
r26315:3c6902ed default
parent child Browse files
Show More
@@ -283,7 +283,7 b' def mergecopies(repo, c1, c2, ca):'
283 283
284 284
285 285 def setupctx(ctx):
286 """return a 'makectx' function suitable for checkcopies usage from ctx
286 """return a 'getfctx' function suitable for checkcopies usage
287 287
288 288 We have to re-setup the function building 'filectx' for each
289 289 'checkcopies' to ensure the linkrev adjustement is properly setup for
@@ -328,12 +328,12 b' def mergecopies(repo, c1, c2, ca):'
328 328 u1, u2 = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
329 329
330 330 for f in u1:
331 ctx = setupctx(c1)
332 checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy)
331 getfctx = setupctx(c1)
332 checkcopies(getfctx, f, m1, m2, ca, limit, diverge, copy, fullcopy)
333 333
334 334 for f in u2:
335 ctx = setupctx(c2)
336 checkcopies(ctx, f, m2, m1, ca, limit, diverge, copy, fullcopy)
335 getfctx = setupctx(c2)
336 checkcopies(getfctx, f, m2, m1, ca, limit, diverge, copy, fullcopy)
337 337
338 338 renamedelete = {}
339 339 renamedelete2 = set()
@@ -355,10 +355,12 b' def mergecopies(repo, c1, c2, ca):'
355 355 % "\n ".join(bothnew))
356 356 bothdiverge, _copy, _fullcopy = {}, {}, {}
357 357 for f in bothnew:
358 ctx = setupctx(c1)
359 checkcopies(ctx, f, m1, m2, ca, limit, bothdiverge, _copy, _fullcopy)
360 ctx = setupctx(c2)
361 checkcopies(ctx, f, m2, m1, ca, limit, bothdiverge, _copy, _fullcopy)
358 getfctx = setupctx(c1)
359 checkcopies(getfctx, f, m1, m2, ca, limit, bothdiverge,
360 _copy, _fullcopy)
361 getfctx = setupctx(c2)
362 checkcopies(getfctx, f, m2, m1, ca, limit, bothdiverge,
363 _copy, _fullcopy)
362 364 for of, fl in bothdiverge.items():
363 365 if len(fl) == 2 and fl[0] == fl[1]:
364 366 copy[fl[0]] = of # not actually divergent, just matching renames
@@ -438,11 +440,11 b' def mergecopies(repo, c1, c2, ca):'
438 440
439 441 return copy, movewithdir, diverge, renamedelete
440 442
441 def checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy):
443 def checkcopies(getfctx, f, m1, m2, ca, limit, diverge, copy, fullcopy):
442 444 """
443 445 check possible copies of f from m1 to m2
444 446
445 ctx = function accepting (filename, node) that returns a filectx.
447 getfctx = function accepting (filename, node) that returns a filectx.
446 448 f = the filename to check
447 449 m1 = the source manifest
448 450 m2 = the destination manifest
@@ -488,7 +490,7 b' def checkcopies(ctx, f, m1, m2, ca, limi'
488 490
489 491 of = None
490 492 seen = set([f])
491 for oc in ctx(f, m1[f]).ancestors():
493 for oc in getfctx(f, m1[f]).ancestors():
492 494 ocr = oc.linkrev()
493 495 of = oc.path()
494 496 if of in seen:
@@ -503,7 +505,7 b' def checkcopies(ctx, f, m1, m2, ca, limi'
503 505 continue # no match, keep looking
504 506 if m2[of] == ma.get(of):
505 507 break # no merge needed, quit early
506 c2 = ctx(of, m2[of])
508 c2 = getfctx(of, m2[of])
507 509 cr = _related(oc, c2, ca.rev())
508 510 if cr and (of == f or of == c2.path()): # non-divergent
509 511 copy[f] = of
General Comments 0
You need to be logged in to leave comments. Login now