Mercurial > hg
comparison hgext/largefiles/overrides.py @ 15916:c96148346af8
largefiles: cache new largefiles for new heads when pulling
When the user pulls from a remote repository that is not his default repo, it
is quite likely that he will pull a new head. This means that if he tries to
merge or rebase with the other head, he will run into a problem becuase
largefiles has no way of tracking where the remote repository for this other
head is, so it cannot download the largefiles from this other remote repository.
It will attempt to download them from its default remote repository, which will
not yet contain the largefiles.
This patch solves this problem by caching any new largefiles for all heads
directly into the system cache at the time of the pull, so they are available
later.
This behavior is actually more in line with Mercurial's distributed nature,
because pulling already implies we have a connection to the remote server, but
merging or rebasing does not.
author | Na'Tosha Bard <natosha@unity3d.com> |
---|---|
date | Wed, 18 Jan 2012 11:33:14 +0100 |
parents | 264087940d5b |
children | 2dc599583ebe |
comparison
equal
deleted
inserted
replaced
15915:d4c0fa71de01 | 15916:c96148346af8 |
---|---|
656 else: | 656 else: |
657 repo.lfpullsource = source | 657 repo.lfpullsource = source |
658 if not source: | 658 if not source: |
659 source = 'default' | 659 source = 'default' |
660 result = orig(ui, repo, source, **opts) | 660 result = orig(ui, repo, source, **opts) |
661 # If we do not have the new largefiles for any new heads we pulled, we | |
662 # will run into a problem later if we try to merge or rebase with one of | |
663 # these heads, so cache the largefiles now direclty into the system | |
664 # cache. | |
665 ui.status(_("caching new largefiles\n")) | |
666 numcached = 0 | |
667 branches = repo.branchmap() | |
668 for branch in branches: | |
669 heads = repo.branchheads(branch) | |
670 for head in heads: | |
671 (cached, missing) = lfcommands.cachelfiles(ui, repo, head) | |
672 numcached += len(cached) | |
673 ui.status(_("%d largefiles cached\n" % numcached)) | |
661 return result | 674 return result |
662 | 675 |
663 def override_rebase(orig, ui, repo, **opts): | 676 def override_rebase(orig, ui, repo, **opts): |
664 repo._isrebasing = True | 677 repo._isrebasing = True |
665 try: | 678 try: |