Mercurial > hg
comparison hgext/largefiles/overrides.py @ 39854:823a580448d7
largefiles: automatically load largefiles extension when required (BC)
This is very similar to what we just did for LFS but for largefiles.
See recent commit messages for the rationale here.
Differential Revision: https://phab.mercurial-scm.org/D4713
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 20 Sep 2018 15:30:00 -0700 |
parents | d3d4b4b5f725 |
children | 3d76a8e627a6 |
comparison
equal
deleted
inserted
replaced
39853:bcf72d7b1524 | 39854:823a580448d7 |
---|---|
887 # from the peer. Therefore the largefiles can't be downloaded and the | 887 # from the peer. Therefore the largefiles can't be downloaded and the |
888 # hgrc can't be updated. | 888 # hgrc can't be updated. |
889 if not repo: | 889 if not repo: |
890 return result | 890 return result |
891 | 891 |
892 # If largefiles is required for this repo, permanently enable it locally | |
893 if 'largefiles' in repo.requirements: | |
894 repo.vfs.append('hgrc', | |
895 util.tonativeeol('\n[extensions]\nlargefiles=\n')) | |
896 | |
897 # Caching is implicitly limited to 'rev' option, since the dest repo was | 892 # Caching is implicitly limited to 'rev' option, since the dest repo was |
898 # truncated at that point. The user may expect a download count with | 893 # truncated at that point. The user may expect a download count with |
899 # this option, so attempt whether or not this is a largefile repo. | 894 # this option, so attempt whether or not this is a largefile repo. |
900 if opts.get('all_largefiles'): | 895 if opts.get('all_largefiles'): |
901 success, missing = lfcommands.downloadlfiles(ui, repo, None) | 896 success, missing = lfcommands.downloadlfiles(ui, repo, None) |
902 | 897 |
903 if missing != 0: | 898 if missing != 0: |
904 return None | 899 return None |
905 | 900 |
906 return result | 901 return result |
907 | |
908 def hgpostshare(orig, sourcerepo, destrepo, defaultpath=None): | |
909 orig(sourcerepo, destrepo, defaultpath=defaultpath) | |
910 | |
911 # If largefiles is required for this repo, permanently enable it locally | |
912 if 'largefiles' in destrepo.requirements: | |
913 destrepo.vfs.append('hgrc', | |
914 util.tonativeeol('\n[extensions]\nlargefiles=\n')) | |
915 | 902 |
916 def overriderebase(orig, ui, repo, **opts): | 903 def overriderebase(orig, ui, repo, **opts): |
917 if not util.safehasattr(repo, '_largefilesenabled'): | 904 if not util.safehasattr(repo, '_largefilesenabled'): |
918 return orig(ui, repo, **opts) | 905 return orig(ui, repo, **opts) |
919 | 906 |