##// 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 def setupctx(ctx):
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 We have to re-setup the function building 'filectx' for each
288 We have to re-setup the function building 'filectx' for each
289 'checkcopies' to ensure the linkrev adjustement is properly setup for
289 'checkcopies' to ensure the linkrev adjustement is properly setup for
@@ -328,12 +328,12 b' def mergecopies(repo, c1, c2, ca):'
328 u1, u2 = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
328 u1, u2 = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
329
329
330 for f in u1:
330 for f in u1:
331 ctx = setupctx(c1)
331 getfctx = setupctx(c1)
332 checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy)
332 checkcopies(getfctx, f, m1, m2, ca, limit, diverge, copy, fullcopy)
333
333
334 for f in u2:
334 for f in u2:
335 ctx = setupctx(c2)
335 getfctx = setupctx(c2)
336 checkcopies(ctx, f, m2, m1, ca, limit, diverge, copy, fullcopy)
336 checkcopies(getfctx, f, m2, m1, ca, limit, diverge, copy, fullcopy)
337
337
338 renamedelete = {}
338 renamedelete = {}
339 renamedelete2 = set()
339 renamedelete2 = set()
@@ -355,10 +355,12 b' def mergecopies(repo, c1, c2, ca):'
355 % "\n ".join(bothnew))
355 % "\n ".join(bothnew))
356 bothdiverge, _copy, _fullcopy = {}, {}, {}
356 bothdiverge, _copy, _fullcopy = {}, {}, {}
357 for f in bothnew:
357 for f in bothnew:
358 ctx = setupctx(c1)
358 getfctx = setupctx(c1)
359 checkcopies(ctx, f, m1, m2, ca, limit, bothdiverge, _copy, _fullcopy)
359 checkcopies(getfctx, f, m1, m2, ca, limit, bothdiverge,
360 ctx = setupctx(c2)
360 _copy, _fullcopy)
361 checkcopies(ctx, f, m2, m1, ca, limit, bothdiverge, _copy, _fullcopy)
361 getfctx = setupctx(c2)
362 checkcopies(getfctx, f, m2, m1, ca, limit, bothdiverge,
363 _copy, _fullcopy)
362 for of, fl in bothdiverge.items():
364 for of, fl in bothdiverge.items():
363 if len(fl) == 2 and fl[0] == fl[1]:
365 if len(fl) == 2 and fl[0] == fl[1]:
364 copy[fl[0]] = of # not actually divergent, just matching renames
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 return copy, movewithdir, diverge, renamedelete
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 check possible copies of f from m1 to m2
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 f = the filename to check
448 f = the filename to check
447 m1 = the source manifest
449 m1 = the source manifest
448 m2 = the destination manifest
450 m2 = the destination manifest
@@ -488,7 +490,7 b' def checkcopies(ctx, f, m1, m2, ca, limi'
488
490
489 of = None
491 of = None
490 seen = set([f])
492 seen = set([f])
491 for oc in ctx(f, m1[f]).ancestors():
493 for oc in getfctx(f, m1[f]).ancestors():
492 ocr = oc.linkrev()
494 ocr = oc.linkrev()
493 of = oc.path()
495 of = oc.path()
494 if of in seen:
496 if of in seen:
@@ -503,7 +505,7 b' def checkcopies(ctx, f, m1, m2, ca, limi'
503 continue # no match, keep looking
505 continue # no match, keep looking
504 if m2[of] == ma.get(of):
506 if m2[of] == ma.get(of):
505 break # no merge needed, quit early
507 break # no merge needed, quit early
506 c2 = ctx(of, m2[of])
508 c2 = getfctx(of, m2[of])
507 cr = _related(oc, c2, ca.rev())
509 cr = _related(oc, c2, ca.rev())
508 if cr and (of == f or of == c2.path()): # non-divergent
510 if cr and (of == f or of == c2.path()): # non-divergent
509 copy[f] = of
511 copy[f] = of
General Comments 0
You need to be logged in to leave comments. Login now