diff -r 4999c12c526b -r 56b930238036 hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py Sun Oct 16 02:26:38 2016 +0200 +++ b/hgext/largefiles/overrides.py Sun Oct 16 02:29:45 2016 +0200 @@ -1390,7 +1390,8 @@ lfdirstate = lfutil.openlfdirstate(repo.ui, repo) unsure, s = lfdirstate.status(matchmod.always(repo.root, repo.getcwd()), - [], False, False, False) + [], False, True, False) + oldclean = set(s.clean) pctx = repo['.'] for lfile in unsure + s.modified: lfileabs = repo.wvfs.join(lfile) @@ -1402,9 +1403,13 @@ lfutil.getexecutable(lfileabs)) if (standin in pctx and lfhash == lfutil.readstandin(repo, lfile, '.')): - lfdirstate.normal(lfile) + oldclean.add(lfile) for lfile in s.added: lfutil.updatestandin(repo, lfutil.standin(lfile)) + # mark all clean largefiles as dirty, just in case the update gets + # interrupted before largefiles and lfdirstate are synchronized + for lfile in oldclean: + lfdirstate.normallookup(lfile) lfdirstate.write() oldstandins = lfutil.getstandinsstate(repo) @@ -1413,6 +1418,13 @@ newstandins = lfutil.getstandinsstate(repo) filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) + + # to avoid leaving all largefiles as dirty and thus rehash them, mark + # all the ones that didn't change as clean + for lfile in oldclean.difference(filelist): + lfdirstate.normal(lfile) + lfdirstate.write() + if branchmerge or force or partial: filelist.extend(s.deleted + s.removed)