Mercurial > public > mercurial-scm > hg
comparison mercurial/copies.py @ 33822:42ad7cc645a4
copies: add more details to the documentation of mergecopies()
This documentation is very helpful for any developer to understand what
copytracing is and what the function does. Since this is the main function of
doing copytracing, I have also included bits about copytracing in it.
This additions are picked from a doc by Stash@Fb. So thanks to him.
Differential Revision: https://phab.mercurial-scm.org/D409
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 16 Aug 2017 00:25:20 +0530 |
parents | aeac3cbcbbc1 |
children | 252fb66ee5bb |
comparison
equal
deleted
inserted
replaced
33821:3c91cc0c5fde | 33822:42ad7cc645a4 |
---|---|
302 remainder[f] = ic | 302 remainder[f] = ic |
303 return remainder | 303 return remainder |
304 | 304 |
305 def mergecopies(repo, c1, c2, base): | 305 def mergecopies(repo, c1, c2, base): |
306 """ | 306 """ |
307 The basic algorithm for copytracing. Copytracing is used in commands like | |
308 rebase, merge, unshelve, etc to merge files that were moved/ copied in one | |
309 merge parent and modified in another. For example: | |
310 | |
311 o ---> 4 another commit | |
312 | | |
313 | o ---> 3 commit that modifies a.txt | |
314 | / | |
315 o / ---> 2 commit that moves a.txt to b.txt | |
316 |/ | |
317 o ---> 1 merge base | |
318 | |
319 If we try to rebase revision 3 on revision 4, since there is no a.txt in | |
320 revision 4, and if user have copytrace disabled, we prints the following | |
321 message: | |
322 | |
323 ```other changed <file> which local deleted``` | |
324 | |
325 If copytrace is enabled, this function finds all the new files that were | |
326 added from merge base up to the top commit (here 4), and for each file it | |
327 checks if this file was copied from another file (a.txt in the above case). | |
328 | |
307 Find moves and copies between context c1 and c2 that are relevant | 329 Find moves and copies between context c1 and c2 that are relevant |
308 for merging. 'base' will be used as the merge base. | 330 for merging. 'base' will be used as the merge base. |
309 | 331 |
310 Returns five dicts: "copy", "movewithdir", "diverge", "renamedelete" and | 332 Returns five dicts: "copy", "movewithdir", "diverge", "renamedelete" and |
311 "dirmove". | 333 "dirmove". |