Mercurial > hg
comparison tests/test-largefiles-update.t @ 30190:56b930238036 stable
largefiles: more safe handling of interruptions while updating modifications
Largefiles are fragile with the design where dirstate and lfdirstate must be
kept in sync.
To be less fragile, mark all clean largefiles as unsure ("normallookup") before
updating standins. After standins have been updated and we know exactly which
largefile standins actually was changed, mark the unchanged largefiles back to
clean ("normal").
This will make the failure mode more safe. If interrupted, the next command
will continue to perform extra hashing of all largefiles. That will do that all
largefiles that are out of sync with their standin will be marked dirty and
they will show up in status and can be cleaned with update --clean.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Sun, 16 Oct 2016 02:29:45 +0200 |
parents | 4999c12c526b |
children | 328545c7d8a1 |
comparison
equal
deleted
inserted
replaced
30189:4999c12c526b | 30190:56b930238036 |
---|---|
730 $ hg status -A --rev tip large2 | 730 $ hg status -A --rev tip large2 |
731 C large2 | 731 C large2 |
732 | 732 |
733 #endif | 733 #endif |
734 | 734 |
735 Test a fatal error interrupting an update. lfdirstate doesn't realize that | 735 Test a fatal error interrupting an update. Verify that status report dirty |
736 .hglf has been updated while the largefile hasn't. Status thus shows a clean | 736 files correctly after an interrupted update. Also verify that checking all |
737 state ... but rebuilding lfdirstate and checking all hashes reveals it isn't | 737 hashes reveals it isn't clean. |
738 clean. | |
739 | 738 |
740 Start with clean dirstates: | 739 Start with clean dirstates: |
741 $ hg up -qcr "8^" | 740 $ hg up -qcr "8^" |
742 $ sleep 1 | 741 $ sleep 1 |
743 $ hg st | 742 $ hg st |
744 Update standins without updating largefiles: | 743 Update standins without updating largefiles - large1 is modified and largeX is |
744 added: | |
745 $ cat << EOF > ../crashupdatelfiles.py | 745 $ cat << EOF > ../crashupdatelfiles.py |
746 > import hgext.largefiles.lfutil | 746 > import hgext.largefiles.lfutil |
747 > def getlfilestoupdate(oldstandins, newstandins): | 747 > def getlfilestoupdate(oldstandins, newstandins): |
748 > raise SystemExit(7) | 748 > raise SystemExit(7) |
749 > hgext.largefiles.lfutil.getlfilestoupdate = getlfilestoupdate | 749 > hgext.largefiles.lfutil.getlfilestoupdate = getlfilestoupdate |
750 > EOF | 750 > EOF |
751 $ hg up -Cr "8" --config extensions.crashupdatelfiles=../crashupdatelfiles.py | 751 $ hg up -Cr "8" --config extensions.crashupdatelfiles=../crashupdatelfiles.py |
752 [7] | 752 [7] |
753 Check large1 content and status: | 753 Check large1 content and status ... and that update will undo modifications: |
754 BUG: largeX is R and large1 is not M and update does nothing | 754 BUG: large is R |
755 $ cat large1 | 755 $ cat large1 |
756 large1 in #3 | 756 large1 in #3 |
757 $ hg st | 757 $ hg st |
758 M large1 | |
758 R largeX | 759 R largeX |
759 $ hg up -Cr . | 760 $ hg up -Cr . |
760 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | 761 getting changed largefiles |
762 1 largefiles updated, 0 removed | |
763 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
764 $ cat large1 | |
765 manually modified before 'hg transplant --continue' | |
761 $ hg st | 766 $ hg st |
762 R largeX | 767 R largeX |
763 Force largefiles rehashing and check again - revealing modifications that | 768 Force largefiles rehashing and check again - which makes it realize that largeX |
764 update now can remove: | 769 not has been removed but just doesn't exist: |
765 $ rm .hg/largefiles/dirstate | 770 $ rm .hg/largefiles/dirstate |
766 $ hg st | 771 $ hg st |
767 M large1 | |
768 ! largeX | 772 ! largeX |
769 $ hg up -Cr . | 773 $ hg up -Cr . |
770 getting changed largefiles | 774 getting changed largefiles |
771 2 largefiles updated, 0 removed | 775 1 largefiles updated, 0 removed |
772 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 776 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
773 $ hg st | 777 $ hg st |
774 $ cat large1 | |
775 manually modified before 'hg transplant --continue' | |
776 | 778 |
777 $ cd .. | 779 $ cd .. |
778 | 780 |
779 Test that "hg convert" avoids copying largefiles from the working | 781 Test that "hg convert" avoids copying largefiles from the working |
780 directory into store, because "hg convert" doesn't update largefiles | 782 directory into store, because "hg convert" doesn't update largefiles |