##// END OF EJS Templates
largefiles: more safe handling of interruptions while updating modifications...
Mads Kiilerich -
r30190:56b93023 stable
parent child Browse files
Show More
@@ -1390,7 +1390,8 b' def mergeupdate(orig, repo, node, branch'
1390 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1390 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1391 unsure, s = lfdirstate.status(matchmod.always(repo.root,
1391 unsure, s = lfdirstate.status(matchmod.always(repo.root,
1392 repo.getcwd()),
1392 repo.getcwd()),
1393 [], False, False, False)
1393 [], False, True, False)
1394 oldclean = set(s.clean)
1394 pctx = repo['.']
1395 pctx = repo['.']
1395 for lfile in unsure + s.modified:
1396 for lfile in unsure + s.modified:
1396 lfileabs = repo.wvfs.join(lfile)
1397 lfileabs = repo.wvfs.join(lfile)
@@ -1402,9 +1403,13 b' def mergeupdate(orig, repo, node, branch'
1402 lfutil.getexecutable(lfileabs))
1403 lfutil.getexecutable(lfileabs))
1403 if (standin in pctx and
1404 if (standin in pctx and
1404 lfhash == lfutil.readstandin(repo, lfile, '.')):
1405 lfhash == lfutil.readstandin(repo, lfile, '.')):
1405 lfdirstate.normal(lfile)
1406 oldclean.add(lfile)
1406 for lfile in s.added:
1407 for lfile in s.added:
1407 lfutil.updatestandin(repo, lfutil.standin(lfile))
1408 lfutil.updatestandin(repo, lfutil.standin(lfile))
1409 # mark all clean largefiles as dirty, just in case the update gets
1410 # interrupted before largefiles and lfdirstate are synchronized
1411 for lfile in oldclean:
1412 lfdirstate.normallookup(lfile)
1408 lfdirstate.write()
1413 lfdirstate.write()
1409
1414
1410 oldstandins = lfutil.getstandinsstate(repo)
1415 oldstandins = lfutil.getstandinsstate(repo)
@@ -1413,6 +1418,13 b' def mergeupdate(orig, repo, node, branch'
1413
1418
1414 newstandins = lfutil.getstandinsstate(repo)
1419 newstandins = lfutil.getstandinsstate(repo)
1415 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
1420 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
1421
1422 # to avoid leaving all largefiles as dirty and thus rehash them, mark
1423 # all the ones that didn't change as clean
1424 for lfile in oldclean.difference(filelist):
1425 lfdirstate.normal(lfile)
1426 lfdirstate.write()
1427
1416 if branchmerge or force or partial:
1428 if branchmerge or force or partial:
1417 filelist.extend(s.deleted + s.removed)
1429 filelist.extend(s.deleted + s.removed)
1418
1430
@@ -732,16 +732,16 b' bit correctly on the platform being unaw'
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):
@@ -750,29 +750,31 b' Update standins without updating largefi'
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
General Comments 0
You need to be logged in to leave comments. Login now