Patchwork D409: copies: add more details to the documentation of mergecopies()

login
register
mail settings
Submitter phabricator
Date Aug. 15, 2017, 9:32 p.m.
Message ID <4db197d1b49ba95021af786f683ff25b@localhost.localdomain>
Download mbox | patch
Permalink /patch/23047/
State Not Applicable
Headers show

Comments

phabricator - Aug. 15, 2017, 9:32 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG42ad7cc645a4: copies: add more details to the documentation of mergecopies() (authored by pulkit).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D409?vs=942&id=950

REVISION DETAIL
  https://phab.mercurial-scm.org/D409

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS




To: pulkit, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -304,6 +304,28 @@ 
 
 def mergecopies(repo, c1, c2, base):
     """
+    The basic algorithm for copytracing. Copytracing is used in commands like
+    rebase, merge, unshelve, etc to merge files that were moved/ copied in one
+    merge parent and modified in another. For example:
+
+    o          ---> 4 another commit
+    |
+    |   o      ---> 3 commit that modifies a.txt
+    |  /
+    o /        ---> 2 commit that moves a.txt to b.txt
+    |/
+    o          ---> 1 merge base
+
+    If we try to rebase revision 3 on revision 4, since there is no a.txt in
+    revision 4, and if user have copytrace disabled, we prints the following
+    message:
+
+    ```other changed <file> which local deleted```
+
+    If copytrace is enabled, this function finds all the new files that were
+    added from merge base up to the top commit (here 4), and for each file it
+    checks if this file was copied from another file (a.txt in the above case).
+
     Find moves and copies between context c1 and c2 that are relevant
     for merging. 'base' will be used as the merge base.