Skip to content

Commit

Permalink
Proper deprecation of submodule functions in Repository
Browse files Browse the repository at this point in the history
  • Loading branch information
jorio committed Nov 23, 2023
1 parent 1f0b0e6 commit 236a040
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions pygit2/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,33 +130,21 @@ def __iter__(self):
#

def add_submodule(self, *args, **kwargs):
""" Deprecated. Use Repository.submodules.add(...) instead. """
warnings.warn("Use repo.submodules.add(...)", DeprecationWarning)
return self.submodules.add(*args, **kwargs)

def lookup_submodule(self, path: str) -> Submodule:
""" Deprecated. Use Repository.submodules[...] instead. """
warnings.warn("Use repo.submodules[...]", DeprecationWarning)
return self.submodules[path]

def init_submodules(self, *args, **kwargs):
""" Deprecated. Use Repository.submodules.init(...) instead. """
warnings.warn("Use repo.submodules.init(...)", DeprecationWarning)
return self.submodules.init(*args, **kwargs)

def update_submodules(self, *args, **kwargs):
""" Deprecated. Use Repository.submodules.update(...) instead. """
warnings.warn("Use repo.submodules.update(...)", DeprecationWarning)
return self.submodules.update(*args, **kwargs)

def submodule_status(self, *args, **kwargs):
""" Deprecated. Use Repository.submodules.status(...) instead. """
return self.submodules.status(*args, **kwargs)

def submodule_cache_all(self):
""" Deprecated. Use Repository.submodules.cache_all(...) instead. """
return self.submodules.cache_all()

def submodule_cache_clear(self):
""" Deprecated. Use Repository.submodules.cache_clear(...) instead. """
return self.submodules.cache_clear()

#
# Mapping interface
#
Expand Down

0 comments on commit 236a040

Please sign in to comment.