##// END OF EJS Templates
amend: add tests for amending only some files from commit to be amended...
Saurabh Singh -
r34061:6fb5a06b default
parent child Browse files
Show More
@@ -1174,3 +1174,96 b' Test if amend preserves executable bit c'
1174 1174 new mode 100755
1175 1175
1176 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
General Comments 0
You need to be logged in to leave comments. Login now