Mercurial > hg
comparison tests/test-commit-amend.t @ 34059:6fb5a06b92c6
amend: add tests for amending only some files from commit to be amended
We do not have robust enough tests for scenarios where only some files in a
changeset are amended. This presents an interesting scenario because the
working copy could have modified versions of the remaining files in the
pre-amend changeset. Therefore, I have added some tests to ensure that amend
behaves as expected in these scenarios.
Test Plan:
Ensured that the test "test-commit-amend.t" passes.
Differential Revision: https://phab.mercurial-scm.org/D596
author | Saurabh Singh <singhsrb@fb.com> |
---|---|
date | Fri, 01 Sep 2017 12:34:34 -0700 |
parents | 9dcc3529e002 |
children | e8a7c1a0565a |
comparison
equal
deleted
inserted
replaced
34058:4bf1889456f3 | 34059:6fb5a06b92c6 |
---|---|
1172 diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py | 1172 diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py |
1173 old mode 100644 | 1173 old mode 100644 |
1174 new mode 100755 | 1174 new mode 100755 |
1175 | 1175 |
1176 #endif | 1176 #endif |
1177 | |
1178 Test amend with file inclusion options | |
1179 -------------------------------------- | |
1180 | |
1181 These tests ensure that we are always amending some files that were part of the | |
1182 pre-amend commit. We want to test that the remaining files in the pre-amend | |
1183 commit were not changed in the amended commit. We do so by performing a diff of | |
1184 the amended commit against its parent commit. | |
1185 $ cd .. | |
1186 $ hg init testfileinclusions | |
1187 $ cd testfileinclusions | |
1188 $ echo a > a | |
1189 $ echo b > b | |
1190 $ hg commit -Aqm "Adding a and b" | |
1191 | |
1192 Only add changes to a particular file | |
1193 $ echo a >> a | |
1194 $ echo b >> b | |
1195 $ hg commit --amend -I a | |
1196 $ hg diff --git -r null -r . | |
1197 diff --git a/a b/a | |
1198 new file mode 100644 | |
1199 --- /dev/null | |
1200 +++ b/a | |
1201 @@ -0,0 +1,2 @@ | |
1202 +a | |
1203 +a | |
1204 diff --git a/b b/b | |
1205 new file mode 100644 | |
1206 --- /dev/null | |
1207 +++ b/b | |
1208 @@ -0,0 +1,1 @@ | |
1209 +b | |
1210 | |
1211 $ echo a >> a | |
1212 $ hg commit --amend b | |
1213 $ hg diff --git -r null -r . | |
1214 diff --git a/a b/a | |
1215 new file mode 100644 | |
1216 --- /dev/null | |
1217 +++ b/a | |
1218 @@ -0,0 +1,2 @@ | |
1219 +a | |
1220 +a | |
1221 diff --git a/b b/b | |
1222 new file mode 100644 | |
1223 --- /dev/null | |
1224 +++ b/b | |
1225 @@ -0,0 +1,2 @@ | |
1226 +b | |
1227 +b | |
1228 | |
1229 Exclude changes to a particular file | |
1230 $ echo b >> b | |
1231 $ hg commit --amend -X a | |
1232 $ hg diff --git -r null -r . | |
1233 diff --git a/a b/a | |
1234 new file mode 100644 | |
1235 --- /dev/null | |
1236 +++ b/a | |
1237 @@ -0,0 +1,2 @@ | |
1238 +a | |
1239 +a | |
1240 diff --git a/b b/b | |
1241 new file mode 100644 | |
1242 --- /dev/null | |
1243 +++ b/b | |
1244 @@ -0,0 +1,3 @@ | |
1245 +b | |
1246 +b | |
1247 +b | |
1248 | |
1249 Check the addremove flag | |
1250 $ echo c > c | |
1251 $ rm a | |
1252 $ hg commit --amend -A | |
1253 removing a | |
1254 adding c | |
1255 $ hg diff --git -r null -r . | |
1256 diff --git a/b b/b | |
1257 new file mode 100644 | |
1258 --- /dev/null | |
1259 +++ b/b | |
1260 @@ -0,0 +1,3 @@ | |
1261 +b | |
1262 +b | |
1263 +b | |
1264 diff --git a/c b/c | |
1265 new file mode 100644 | |
1266 --- /dev/null | |
1267 +++ b/c | |
1268 @@ -0,0 +1,1 @@ | |
1269 +c |