2806 return makelocalrepository(ui, localpath, intents=intents) |
2806 return makelocalrepository(ui, localpath, intents=intents) |
2807 |
2807 |
2808 def islocal(path): |
2808 def islocal(path): |
2809 return True |
2809 return True |
2810 |
2810 |
2811 def newreporequirements(ui, createopts=None): |
2811 def defaultcreateopts(ui, createopts=None): |
|
2812 """Populate the default creation options for a repository. |
|
2813 |
|
2814 A dictionary of explicitly requested creation options can be passed |
|
2815 in. Missing keys will be populated. |
|
2816 """ |
|
2817 createopts = dict(createopts or {}) |
|
2818 |
|
2819 if 'backend' not in createopts: |
|
2820 # experimental config: storage.new-repo-backend |
|
2821 createopts['backend'] = ui.config('storage', 'new-repo-backend') |
|
2822 |
|
2823 return createopts |
|
2824 |
|
2825 def newreporequirements(ui, createopts): |
2812 """Determine the set of requirements for a new local repository. |
2826 """Determine the set of requirements for a new local repository. |
2813 |
2827 |
2814 Extensions can wrap this function to specify custom requirements for |
2828 Extensions can wrap this function to specify custom requirements for |
2815 new repositories. |
2829 new repositories. |
2816 """ |
2830 """ |
2817 createopts = createopts or {} |
|
2818 |
|
2819 # If the repo is being created from a shared repository, we copy |
2831 # If the repo is being created from a shared repository, we copy |
2820 # its requirements. |
2832 # its requirements. |
2821 if 'sharedrepo' in createopts: |
2833 if 'sharedrepo' in createopts: |
2822 requirements = set(createopts['sharedrepo'].requirements) |
2834 requirements = set(createopts['sharedrepo'].requirements) |
2823 if createopts.get('sharedrelative'): |
2835 if createopts.get('sharedrelative'): |
2824 requirements.add('relshared') |
2836 requirements.add('relshared') |
2825 else: |
2837 else: |
2826 requirements.add('shared') |
2838 requirements.add('shared') |
2827 |
2839 |
2828 return requirements |
2840 return requirements |
|
2841 |
|
2842 if 'backend' not in createopts: |
|
2843 raise error.ProgrammingError('backend key not present in createopts; ' |
|
2844 'was defaultcreateopts() called?') |
|
2845 |
|
2846 if createopts['backend'] != 'revlogv1': |
|
2847 raise error.Abort(_('unable to determine repository requirements for ' |
|
2848 'storage backend: %s') % createopts['backend']) |
2829 |
2849 |
2830 requirements = {'revlogv1'} |
2850 requirements = {'revlogv1'} |
2831 if ui.configbool('format', 'usestore'): |
2851 if ui.configbool('format', 'usestore'): |
2832 requirements.add('store') |
2852 requirements.add('store') |
2833 if ui.configbool('format', 'usefncache'): |
2853 if ui.configbool('format', 'usefncache'): |
2899 ``path`` path to the new repo's working directory. |
2920 ``path`` path to the new repo's working directory. |
2900 ``createopts`` options for the new repository. |
2921 ``createopts`` options for the new repository. |
2901 |
2922 |
2902 The following keys for ``createopts`` are recognized: |
2923 The following keys for ``createopts`` are recognized: |
2903 |
2924 |
|
2925 backend |
|
2926 The storage backend to use. |
2904 narrowfiles |
2927 narrowfiles |
2905 Set up repository to support narrow file storage. |
2928 Set up repository to support narrow file storage. |
2906 sharedrepo |
2929 sharedrepo |
2907 Repository object from which storage should be shared. |
2930 Repository object from which storage should be shared. |
2908 sharedrelative |
2931 sharedrelative |
2910 stored as relative. By default, the pointer to the "parent" repo |
2933 stored as relative. By default, the pointer to the "parent" repo |
2911 is stored as an absolute path. |
2934 is stored as an absolute path. |
2912 shareditems |
2935 shareditems |
2913 Set of items to share to the new repository (in addition to storage). |
2936 Set of items to share to the new repository (in addition to storage). |
2914 """ |
2937 """ |
2915 createopts = createopts or {} |
2938 createopts = defaultcreateopts(ui, createopts=createopts) |
2916 |
2939 |
2917 unknownopts = filterknowncreateopts(ui, createopts) |
2940 unknownopts = filterknowncreateopts(ui, createopts) |
2918 |
2941 |
2919 if not isinstance(unknownopts, dict): |
2942 if not isinstance(unknownopts, dict): |
2920 raise error.ProgrammingError('filterknowncreateopts() did not return ' |
2943 raise error.ProgrammingError('filterknowncreateopts() did not return ' |