comparison hgext/largefiles/overrides.py @ 15860:3ecce805ac13

largefiles: correctly download new largefiles when merging There is a bug in the merge process where, if a new largefile is introduced in a merge and the user does not have that largefile in his repo's local store nor in his system cache, the working copy will retain the old largefile. Upon the commit of the merge, the standin is re-written to contain the hash of the old largefile, and the lfdirstate retains a "Modified" status for the file. The end result is that the largefile can show up in the merge commit as "Modified", but the standin has no diff. This is wrong in two ways: 1) Such a "wedged" history with a nonsense change in a commit should not be possible 2) It effectively reverts a largefile to an old version when doing a merge This is caused by the fact that the updatelfiles() command always checks the current largefile's hash against the hash stored in the current node's standin. This is correct behavior in every case except for a merge. When merging, we must assume that the standin in the working copy contains the correct hash, because the original hg.merge() has already updated it for us. This patch fixes the issue by patching the repo object to carry a "_ismerging" attribute, that the updatelfiles() command checks for. When this attribute is found, it checks against the working copy's standin, rather than the standin in the current node.
author Na'Tosha Bard <natosha@unity3d.com>
date Wed, 11 Jan 2012 16:53:51 +0100
parents 0d91211dd12f
children 264087940d5b
comparison
equal deleted inserted replaced
15859:44a371823f83 15860:3ecce805ac13
610 result = orig(repo, node, show_stats) 610 result = orig(repo, node, show_stats)
611 lfcommands.updatelfiles(repo.ui, repo) 611 lfcommands.updatelfiles(repo.ui, repo)
612 return result 612 return result
613 613
614 def hg_merge(orig, repo, node, force=None, remind=True): 614 def hg_merge(orig, repo, node, force=None, remind=True):
615 result = orig(repo, node, force, remind) 615 # Mark the repo as being in the middle of a merge, so that
616 lfcommands.updatelfiles(repo.ui, repo) 616 # updatelfiles() will know that it needs to trust the standins in
617 # the working copy, not in the standins in the current node
618 repo._ismerging = True
619 try:
620 result = orig(repo, node, force, remind)
621 lfcommands.updatelfiles(repo.ui, repo)
622 finally:
623 repo._ismerging = False
617 return result 624 return result
618 625
619 # When we rebase a repository with remotely changed largefiles, we need to 626 # When we rebase a repository with remotely changed largefiles, we need to
620 # take some extra care so that the largefiles are correctly updated in the 627 # take some extra care so that the largefiles are correctly updated in the
621 # working copy 628 # working copy