##// END OF EJS Templates
createrepository: allow to directly pass the target requirements...
marmoute -
r48233:e43e6862 default
parent child Browse files
Show More
@@ -3677,11 +3677,13 b' def filterknowncreateopts(ui, createopts'
3677 return {k: v for k, v in createopts.items() if k not in known}
3677 return {k: v for k, v in createopts.items() if k not in known}
3678
3678
3679
3679
3680 def createrepository(ui, path, createopts=None):
3680 def createrepository(ui, path, createopts=None, requirements=None):
3681 """Create a new repository in a vfs.
3681 """Create a new repository in a vfs.
3682
3682
3683 ``path`` path to the new repo's working directory.
3683 ``path`` path to the new repo's working directory.
3684 ``createopts`` options for the new repository.
3684 ``createopts`` options for the new repository.
3685 ``requirement`` predefined set of requirements.
3686 (incompatible with ``createopts``)
3685
3687
3686 The following keys for ``createopts`` are recognized:
3688 The following keys for ``createopts`` are recognized:
3687
3689
@@ -3704,27 +3706,34 b' def createrepository(ui, path, createopt'
3704 Indicates that storage for files should be shallow (not all ancestor
3706 Indicates that storage for files should be shallow (not all ancestor
3705 revisions are known).
3707 revisions are known).
3706 """
3708 """
3707 createopts = defaultcreateopts(ui, createopts=createopts)
3709
3708
3710 if requirements is not None:
3709 unknownopts = filterknowncreateopts(ui, createopts)
3711 if createopts is not None:
3710
3712 msg = b'cannot specify both createopts and requirements'
3711 if not isinstance(unknownopts, dict):
3713 raise error.ProgrammingError(msg)
3712 raise error.ProgrammingError(
3714 createopts = {}
3713 b'filterknowncreateopts() did not return a dict'
3715 else:
3714 )
3716 createopts = defaultcreateopts(ui, createopts=createopts)
3715
3717
3716 if unknownopts:
3718 unknownopts = filterknowncreateopts(ui, createopts)
3717 raise error.Abort(
3719
3718 _(
3720 if not isinstance(unknownopts, dict):
3719 b'unable to create repository because of unknown '
3721 raise error.ProgrammingError(
3720 b'creation option: %s'
3722 b'filterknowncreateopts() did not return a dict'
3721 )
3723 )
3722 % b', '.join(sorted(unknownopts)),
3724
3723 hint=_(b'is a required extension not loaded?'),
3725 if unknownopts:
3724 )
3726 raise error.Abort(
3725
3727 _(
3726 requirements = newreporequirements(ui, createopts=createopts)
3728 b'unable to create repository because of unknown '
3727 requirements -= checkrequirementscompat(ui, requirements)
3729 b'creation option: %s'
3730 )
3731 % b', '.join(sorted(unknownopts)),
3732 hint=_(b'is a required extension not loaded?'),
3733 )
3734
3735 requirements = newreporequirements(ui, createopts=createopts)
3736 requirements -= checkrequirementscompat(ui, requirements)
3728
3737
3729 wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
3738 wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
3730
3739
General Comments 0
You need to be logged in to leave comments. Login now