Mercurial > hg
diff mercurial/metadata.py @ 46814:c52c3c4cbd3f
copies: detect files as `touched/salvaged` if they only existed on one side
The file cannot be merged if there was content to merge on the other side. So
the previous record was wrong.
In the general case, the file existed only on one side and got touched during the
merge. So it should detected as touched.
They are a special case where the merge manually prevent the file to be deleted.
In this case the file is marked as `salvaged`.
The result of this `salvaged` recording, copy-tracing-wise, is the same as
recording it as `merged`. This is probably why they were recorded as `merged` in
the first place.
Differential Revision: https://phab.mercurial-scm.org/D10219
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 15 Mar 2021 13:37:45 +0100 |
parents | bc2519513ae0 |
children | 433cef8f3104 |
line wrap: on
line diff
--- a/mercurial/metadata.py Tue Mar 02 02:00:29 2021 +0100 +++ b/mercurial/metadata.py Mon Mar 15 13:37:45 2021 +0100 @@ -322,12 +322,12 @@ β (Some, None) β OR βπ» Deleted β ΓΈ β ΓΈ β β βπ· Deleted[1] β β β β ββββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββ€ - β βπΈ No Changes β β β β - β (None, Some) β OR β ΓΈ βπΌ Added βπ½ Merged β + β βπΈ No Changes β β β π½ Touched β + β (None, Some) β OR β ΓΈ βπΌ Added βOR π Salvaged β β βπΉ Salvaged[2]β β (copied?) β (copied?) β ββββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββ€ - β β β β β β - β (Some, Some) βπΊ No Changes β ΓΈ βπΎ Merged βπΏ Merged β + β β β β πΎ Touched β β + β (Some, Some) βπΊ No Changes β ΓΈ βOR π Salvaged βπΏ Merged β β β [3] β β (copied?) β (copied?) β ββββββββββββββββ΄βββββββββββββββ΄βββββββββββββββ΄βββββββββββββββ΄βββββββββββββββ @@ -454,8 +454,16 @@ # case π» β both deleted the file. md.mark_removed(filename) elif d1[1][0] is not None and d2[1][0] is not None: - # case π½ πΎ πΏ - md.mark_merged(filename) + if d1[0][0] is None or d2[0][0] is None: + if any(_find(ma, filename) is not None for ma in mas): + # case π or π + md.mark_salvaged(filename) + else: + # case π½ πΎ : touched + md.mark_touched(filename) + else: + # case πΏ : merged + md.mark_merged(filename) copy_candidates.append(filename) else: # Impossible case, the post-merge file status cannot be None on