| 371 | |
| 372 | |
| 373 | def test_reset_mixed(testrepo: Repository) -> None: |
| 374 | ref = '5ebeeebb320790caf276b9fc8b24546d63316533' |
| 375 | with (Path(testrepo.workdir) / 'hello.txt').open() as f: |
| 376 | lines = f.readlines() |
| 377 | assert 'hola mundo\n' in lines |
| 378 | assert 'bonjour le monde\n' in lines |
| 379 | |
| 380 | testrepo.reset(ref, ResetMode.MIXED) |
| 381 | |
| 382 | assert testrepo.head.target == ref |
| 383 | |
| 384 | with (Path(testrepo.workdir) / 'hello.txt').open() as f: |
| 385 | lines = f.readlines() |
| 386 | # mixed reset will not reset the working copy |
| 387 | assert 'hola mundo\n' in lines |
| 388 | assert 'bonjour le monde\n' in lines |
| 389 | |
| 390 | # mixed reset will set the index to match working copy |
| 391 | diff = testrepo.diff(cached=True) |
| 392 | assert diff.patch is not None |
| 393 | assert 'hola mundo\n' in diff.patch |
| 394 | assert 'bonjour le monde\n' in diff.patch |
| 395 | |
| 396 | |
| 397 | def test_stash(testrepo: Repository) -> None: |