Mercurial > hg
comparison tests/test-shelve.t @ 42616:5162753c4c14
unshelve: add interactive mode
Until now, there is no way to `unshelve` selected changes only from
the stored shelve as given in issue6162. This patch makes `unshelve`
perform with certain changes only by adding an interactive mode.
Differential Revision: https://phab.mercurial-scm.org/D6596
author | Navaneeth Suresh <navaneeths1998@gmail.com> |
---|---|
date | Tue, 02 Jul 2019 18:02:12 +0530 |
parents | f802a75da585 |
children | 9eace8d6d537 |
comparison
equal
deleted
inserted
replaced
42615:56132ebd14c6 | 42616:5162753c4c14 |
---|---|
1156 abort: outstanding uncommitted merge | 1156 abort: outstanding uncommitted merge |
1157 (use 'hg commit' or 'hg merge --abort') | 1157 (use 'hg commit' or 'hg merge --abort') |
1158 [255] | 1158 [255] |
1159 | 1159 |
1160 $ cd .. | 1160 $ cd .. |
1161 | |
1162 -- test for interactive mode on unshelve | |
1163 | |
1164 $ hg init a | |
1165 $ cd a | |
1166 $ echo > b | |
1167 $ hg ci -Am b | |
1168 adding b | |
1169 $ echo > c | |
1170 $ echo > d | |
1171 $ hg add . | |
1172 adding c | |
1173 adding d | |
1174 $ hg shelve | |
1175 shelved as default | |
1176 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
1177 $ echo > e | |
1178 $ hg add e | |
1179 $ hg ci -m e | |
1180 $ hg shelve --patch | |
1181 default (1s ago) changes to: b | |
1182 | |
1183 diff --git a/c b/c | |
1184 new file mode 100644 | |
1185 --- /dev/null | |
1186 +++ b/c | |
1187 @@ -0,0 +1,1 @@ | |
1188 + | |
1189 diff --git a/d b/d | |
1190 new file mode 100644 | |
1191 --- /dev/null | |
1192 +++ b/d | |
1193 @@ -0,0 +1,1 @@ | |
1194 + | |
1195 $ hg unshelve -i <<EOF | |
1196 > y | |
1197 > y | |
1198 > y | |
1199 > n | |
1200 > EOF | |
1201 unshelving change 'default' | |
1202 rebasing shelved changes | |
1203 diff --git a/c b/c | |
1204 new file mode 100644 | |
1205 examine changes to 'c'? | |
1206 (enter ? for help) [Ynesfdaq?] y | |
1207 | |
1208 @@ -0,0 +1,1 @@ | |
1209 + | |
1210 record change 1/2 to 'c'? | |
1211 (enter ? for help) [Ynesfdaq?] y | |
1212 | |
1213 diff --git a/d b/d | |
1214 new file mode 100644 | |
1215 examine changes to 'd'? | |
1216 (enter ? for help) [Ynesfdaq?] y | |
1217 | |
1218 @@ -0,0 +1,1 @@ | |
1219 + | |
1220 record change 2/2 to 'd'? | |
1221 (enter ? for help) [Ynesfdaq?] n | |
1222 | |
1223 $ ls | |
1224 b | |
1225 c | |
1226 e | |
1227 -- shelve should not contain `c` now | |
1228 $ hg shelve --patch | |
1229 default (1s ago) changes to: b | |
1230 | |
1231 diff --git a/d b/d | |
1232 new file mode 100644 | |
1233 --- /dev/null | |
1234 +++ b/d | |
1235 @@ -0,0 +1,1 @@ | |
1236 + | |
1237 $ hg unshelve -i <<EOF | |
1238 > y | |
1239 > y | |
1240 > EOF | |
1241 unshelving change 'default' | |
1242 rebasing shelved changes | |
1243 diff --git a/d b/d | |
1244 new file mode 100644 | |
1245 examine changes to 'd'? | |
1246 (enter ? for help) [Ynesfdaq?] y | |
1247 | |
1248 @@ -0,0 +1,1 @@ | |
1249 + | |
1250 record this change to 'd'? | |
1251 (enter ? for help) [Ynesfdaq?] y | |
1252 | |
1253 $ ls | |
1254 b | |
1255 c | |
1256 d | |
1257 e | |
1258 $ hg shelve --list | |
1259 | |
1260 -- now, unshelve selected changes from a file | |
1261 | |
1262 $ echo B > foo | |
1263 $ hg add foo | |
1264 $ hg ci -m 'add B to foo' | |
1265 $ cat > foo <<EOF | |
1266 > A | |
1267 > B | |
1268 > C | |
1269 > EOF | |
1270 $ hg shelve | |
1271 shelved as default | |
1272 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1273 $ cat foo | |
1274 B | |
1275 $ hg unshelve -i <<EOF | |
1276 > y | |
1277 > y | |
1278 > n | |
1279 > EOF | |
1280 unshelving change 'default' | |
1281 rebasing shelved changes | |
1282 diff --git a/foo b/foo | |
1283 2 hunks, 2 lines changed | |
1284 examine changes to 'foo'? | |
1285 (enter ? for help) [Ynesfdaq?] y | |
1286 | |
1287 @@ -1,1 +1,2 @@ | |
1288 +A | |
1289 B | |
1290 record change 1/2 to 'foo'? | |
1291 (enter ? for help) [Ynesfdaq?] y | |
1292 | |
1293 @@ -1,1 +2,2 @@ | |
1294 B | |
1295 +C | |
1296 record change 2/2 to 'foo'? | |
1297 (enter ? for help) [Ynesfdaq?] n | |
1298 | |
1299 $ cat foo | |
1300 A | |
1301 B | |
1302 $ hg shelve --patch | |
1303 default (1s ago) changes to: add B to foo | |
1304 | |
1305 diff --git a/foo b/foo | |
1306 --- a/foo | |
1307 +++ b/foo | |
1308 @@ -1,2 +1,3 @@ | |
1309 A | |
1310 B | |
1311 +C | |
1312 | |
1313 -- unshelve interactive on conflicts | |
1314 | |
1315 $ echo A >> bar1 | |
1316 $ echo A >> bar2 | |
1317 $ hg add bar1 bar2 | |
1318 $ hg ci -m 'add A to bars' | |
1319 $ echo B >> bar1 | |
1320 $ echo B >> bar2 | |
1321 $ hg shelve | |
1322 shelved as default-01 | |
1323 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1324 $ echo C >> bar1 | |
1325 $ echo C >> bar2 | |
1326 $ hg ci -m 'add C to bars' | |
1327 $ hg unshelve -i | |
1328 unshelving change 'default-01' | |
1329 rebasing shelved changes | |
1330 merging bar1 | |
1331 merging bar2 | |
1332 warning: conflicts while merging bar1! (edit, then use 'hg resolve --mark') | |
1333 warning: conflicts while merging bar2! (edit, then use 'hg resolve --mark') | |
1334 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
1335 [1] | |
1336 | |
1337 $ cat > bar1 <<EOF | |
1338 > A | |
1339 > B | |
1340 > C | |
1341 > EOF | |
1342 $ cat > bar2 <<EOF | |
1343 > A | |
1344 > B | |
1345 > C | |
1346 > EOF | |
1347 $ hg resolve -m bar1 bar2 | |
1348 (no more unresolved files) | |
1349 continue: hg unshelve --continue | |
1350 $ cat bar1 | |
1351 A | |
1352 B | |
1353 C | |
1354 $ hg unshelve --continue -i <<EOF | |
1355 > y | |
1356 > y | |
1357 > y | |
1358 > y | |
1359 > EOF | |
1360 unshelving change 'default-01' | |
1361 diff --git a/bar1 b/bar1 | |
1362 1 hunks, 1 lines changed | |
1363 examine changes to 'bar1'? | |
1364 (enter ? for help) [Ynesfdaq?] y | |
1365 | |
1366 @@ -1,2 +1,3 @@ | |
1367 A | |
1368 +B | |
1369 C | |
1370 record change 1/2 to 'bar1'? | |
1371 (enter ? for help) [Ynesfdaq?] y | |
1372 | |
1373 diff --git a/bar2 b/bar2 | |
1374 1 hunks, 1 lines changed | |
1375 examine changes to 'bar2'? | |
1376 (enter ? for help) [Ynesfdaq?] y | |
1377 | |
1378 @@ -1,2 +1,3 @@ | |
1379 A | |
1380 +B | |
1381 C | |
1382 record change 2/2 to 'bar2'? | |
1383 (enter ? for help) [Ynesfdaq?] y | |
1384 | |
1385 unshelve of 'default-01' complete |