comparison tests/test-commit-amend.t @ 24169:ac41aa4a66ab stable

amend: check for directory renames for both merge parents (issue4516) Before this change, amending a merge would lose the rename information for file adding in the second parents and implicitly renamed into a new directory. In case of the merge, we also look for directory rename data from the second parent. This seems to fix the bug and does not show other issues from the test suite.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 02 Mar 2015 19:01:00 +0000
parents aa4a1672583e
children f903689680e6
comparison
equal deleted inserted replaced
24166:aae338f9da70 24169:ac41aa4a66ab
1055 Before the fix, the copy information was lost. 1055 Before the fix, the copy information was lost.
1056 $ hg status --copies --rev 0 1056 $ hg status --copies --rev 0
1057 A a2 1057 A a2
1058 a0 1058 a0
1059 R a0 1059 R a0
1060 $ cd ..
1061
1062 Check that amend properly preserve rename from directory rename (issue-4516)
1063
1064 If a parent of the merge renames a full directory, any files added to the old
1065 directory in the other parent will be renamed to the new directory. For some
1066 reason, the rename metadata was when amending such merge. This test ensure we
1067 do not regress. We have a dedicated repo because it needs a setup with renamed
1068 directory)
1069
1070 $ hg init issue4516
1071 $ cd issue4516
1072 $ mkdir olddirname
1073 $ echo line1 > olddirname/commonfile.py
1074 $ hg add olddirname/commonfile.py
1075 $ hg ci -m first
1076
1077 $ hg branch newdirname
1078 marked working directory as branch newdirname
1079 (branches are permanent and global, did you want a bookmark?)
1080 $ hg mv olddirname newdirname
1081 moving olddirname/commonfile.py to newdirname/commonfile.py (glob)
1082 $ hg ci -m rename
1083
1084 $ hg update default
1085 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1086 $ echo line1 > olddirname/newfile.py
1087 $ hg add olddirname/newfile.py
1088 $ hg ci -m log
1089
1090 $ hg up newdirname
1091 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1092 $ # create newdirname/newfile.py
1093 $ hg merge default
1094 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1095 (branch merge, don't forget to commit)
1096 $ hg ci -m add
1097 $
1098 $ hg debugrename newdirname/newfile.py
1099 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1100 $ hg status -C --change .
1101 A newdirname/newfile.py
1102 $ hg status -C --rev 1
1103 A newdirname/newfile.py
1104 $ hg status -C --rev 2
1105 A newdirname/commonfile.py
1106 olddirname/commonfile.py
1107 A newdirname/newfile.py
1108 olddirname/newfile.py
1109 R olddirname/commonfile.py
1110 R olddirname/newfile.py
1111 $ hg debugindex newdirname/newfile.py
1112 rev offset length base linkrev nodeid p1 p2
1113 0 0 88 0 3 34a4d536c0c0 000000000000 000000000000
1114
1115 $ echo a >> newdirname/commonfile.py
1116 $ hg ci --amend -m bug
1117 $ hg debugrename newdirname/newfile.py
1118 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1119 $ hg debugindex newdirname/newfile.py
1120 rev offset length base linkrev nodeid p1 p2
1121 0 0 88 0 3 34a4d536c0c0 000000000000 000000000000
1122