Mercurial > public > mercurial-scm > hg
comparison mercurial/copies.py @ 30048:91a3c58ecf93
copies: mark checkcopies as internal with the _ prefix
author | G?bor Stefanik <gabor.stefanik@nng.com> |
---|---|
date | Mon, 03 Oct 2016 13:24:56 +0200 |
parents | d13a7c8bf0a5 |
children | 2c8ec8c2ddfe |
comparison
equal
deleted
inserted
replaced
30047:d13a7c8bf0a5 | 30048:91a3c58ecf93 |
---|---|
249 repo.ui.debug(" unmatched files in other:\n %s\n" | 249 repo.ui.debug(" unmatched files in other:\n %s\n" |
250 % "\n ".join(u2)) | 250 % "\n ".join(u2)) |
251 return u1, u2 | 251 return u1, u2 |
252 | 252 |
253 def _makegetfctx(ctx): | 253 def _makegetfctx(ctx): |
254 """return a 'getfctx' function suitable for checkcopies usage | 254 """return a 'getfctx' function suitable for _checkcopies usage |
255 | 255 |
256 We have to re-setup the function building 'filectx' for each | 256 We have to re-setup the function building 'filectx' for each |
257 'checkcopies' to ensure the linkrev adjustment is properly setup for | 257 '_checkcopies' to ensure the linkrev adjustment is properly setup for |
258 each. Linkrev adjustment is important to avoid bug in rename | 258 each. Linkrev adjustment is important to avoid bug in rename |
259 detection. Moreover, having a proper '_ancestrycontext' setup ensures | 259 detection. Moreover, having a proper '_ancestrycontext' setup ensures |
260 the performance impact of this adjustment is kept limited. Without it, | 260 the performance impact of this adjustment is kept limited. Without it, |
261 each file could do a full dag traversal making the time complexity of | 261 each file could do a full dag traversal making the time complexity of |
262 the operation explode (see issue4537). | 262 the operation explode (see issue4537). |
329 | 329 |
330 m1 = c1.manifest() | 330 m1 = c1.manifest() |
331 m2 = c2.manifest() | 331 m2 = c2.manifest() |
332 ma = ca.manifest() | 332 ma = ca.manifest() |
333 | 333 |
334 # see checkcopies documentation below for these dicts | 334 # see _checkcopies documentation below for these dicts |
335 copy1, copy2 = {}, {} | 335 copy1, copy2 = {}, {} |
336 movewithdir1, movewithdir2 = {}, {} | 336 movewithdir1, movewithdir2 = {}, {} |
337 fullcopy1, fullcopy2 = {}, {} | 337 fullcopy1, fullcopy2 = {}, {} |
338 diverge = {} | 338 diverge = {} |
339 | 339 |
343 u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2) | 343 u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2) |
344 u1u, u2u = u1r, u2r | 344 u1u, u2u = u1r, u2r |
345 bothnew = sorted(addedinm1 & addedinm2) | 345 bothnew = sorted(addedinm1 & addedinm2) |
346 | 346 |
347 for f in u1u: | 347 for f in u1u: |
348 checkcopies(c1, f, m1, m2, ca, limit, diverge, copy1, fullcopy1) | 348 _checkcopies(c1, f, m1, m2, ca, limit, diverge, copy1, fullcopy1) |
349 | 349 |
350 for f in u2u: | 350 for f in u2u: |
351 checkcopies(c2, f, m2, m1, ca, limit, diverge, copy2, fullcopy2) | 351 _checkcopies(c2, f, m2, m1, ca, limit, diverge, copy2, fullcopy2) |
352 | 352 |
353 copy = dict(copy1.items() + copy2.items()) | 353 copy = dict(copy1.items() + copy2.items()) |
354 movewithdir = dict(movewithdir1.items() + movewithdir2.items()) | 354 movewithdir = dict(movewithdir1.items() + movewithdir2.items()) |
355 fullcopy = dict(fullcopy1.items() + fullcopy2.items()) | 355 fullcopy = dict(fullcopy1.items() + fullcopy2.items()) |
356 | 356 |
371 if bothnew: | 371 if bothnew: |
372 repo.ui.debug(" unmatched files new in both:\n %s\n" | 372 repo.ui.debug(" unmatched files new in both:\n %s\n" |
373 % "\n ".join(bothnew)) | 373 % "\n ".join(bothnew)) |
374 bothdiverge, _copy, _fullcopy = {}, {}, {} | 374 bothdiverge, _copy, _fullcopy = {}, {}, {} |
375 for f in bothnew: | 375 for f in bothnew: |
376 checkcopies(c1, f, m1, m2, ca, limit, bothdiverge, _copy, _fullcopy) | 376 _checkcopies(c1, f, m1, m2, ca, limit, bothdiverge, _copy, _fullcopy) |
377 checkcopies(c2, f, m2, m1, ca, limit, bothdiverge, _copy, _fullcopy) | 377 _checkcopies(c2, f, m2, m1, ca, limit, bothdiverge, _copy, _fullcopy) |
378 for of, fl in bothdiverge.items(): | 378 for of, fl in bothdiverge.items(): |
379 if len(fl) == 2 and fl[0] == fl[1]: | 379 if len(fl) == 2 and fl[0] == fl[1]: |
380 copy[fl[0]] = of # not actually divergent, just matching renames | 380 copy[fl[0]] = of # not actually divergent, just matching renames |
381 | 381 |
382 if fullcopy and repo.ui.debugflag: | 382 if fullcopy and repo.ui.debugflag: |
452 "dst: '%s'\n") % (f, df)) | 452 "dst: '%s'\n") % (f, df)) |
453 break | 453 break |
454 | 454 |
455 return copy, movewithdir, diverge, renamedelete | 455 return copy, movewithdir, diverge, renamedelete |
456 | 456 |
457 def checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy): | 457 def _checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy): |
458 """ | 458 """ |
459 check possible copies of f from m1 to m2 | 459 check possible copies of f from m1 to m2 |
460 | 460 |
461 ctx = starting context for f in m1 | 461 ctx = starting context for f in m1 |
462 f = the filename to check | 462 f = the filename to check |