diff options
Diffstat (limited to 'git/objects/submodule')
-rw-r--r-- | git/objects/submodule/base.py | 5 | ||||
-rw-r--r-- | git/objects/submodule/root.py | 5 | ||||
-rw-r--r-- | git/objects/submodule/util.py | 7 |
3 files changed, 12 insertions, 5 deletions
diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index 730642ed..42048028 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -34,6 +34,7 @@ __all__ = ["Submodule", "UpdateProgress"] class UpdateProgress(RemoteProgress): + """Class providing detailed progress information to the caller who should derive from it and implement the ``update(...)`` message""" CLONE, FETCH, UPDWKTREE = [1 << x for x in range(RemoteProgress._num_op_codes, RemoteProgress._num_op_codes+3)] @@ -53,6 +54,7 @@ UPDWKTREE = UpdateProgress.UPDWKTREE # mechanism which cause plenty of trouble of the only reason for packages and # modules is refactoring - subpackages shoudn't depend on parent packages class Submodule(util.IndexObject, Iterable, Traversable): + """Implements access to a git submodule. They are special in that their sha represents a commit in the submodule's repository which is to be checked out at the path of this instance. @@ -387,7 +389,6 @@ class Submodule(util.IndexObject, Iterable, Traversable): #END handle dry-run progress.update(END|CLONE, 0, 1, prefix+"Done cloning to %s" % module_path) - if not dry_run: # see whether we have a valid branch to checkout try: @@ -415,7 +416,6 @@ class Submodule(util.IndexObject, Iterable, Traversable): #END handle dry_run #END handle initalization - # DETERMINE SHAS TO CHECKOUT ############################ binsha = self.binsha @@ -549,7 +549,6 @@ class Submodule(util.IndexObject, Iterable, Traversable): renamed_module = True #END move physical module - # rename the index entry - have to manipulate the index directly as # git-mv cannot be used on submodules ... yeah try: diff --git a/git/objects/submodule/root.py b/git/objects/submodule/root.py index fb0a65c3..62ad1f05 100644 --- a/git/objects/submodule/root.py +++ b/git/objects/submodule/root.py @@ -11,6 +11,7 @@ __all__ = ["RootModule", "RootUpdateProgress"] class RootUpdateProgress(UpdateProgress): + """Utility class which adds more opcodes to the UpdateProgress""" REMOVE, PATHCHANGE, BRANCHCHANGE, URLCHANGE = [1 << x for x in range(UpdateProgress._num_op_codes, UpdateProgress._num_op_codes+4)] _num_op_codes = UpdateProgress._num_op_codes+4 @@ -24,7 +25,9 @@ BRANCHCHANGE = RootUpdateProgress.BRANCHCHANGE URLCHANGE = RootUpdateProgress.URLCHANGE PATHCHANGE = RootUpdateProgress.PATHCHANGE + class RootModule(Submodule): + """A (virtual) Root of all submodules in the given repository. It can be used to more easily traverse all submodules of the master repository""" @@ -45,7 +48,6 @@ class RootModule(Submodule): branch_path = git.Head.to_full_path(self.k_head_default) ) - def _clear_cache(self): """May not do anything""" pass @@ -107,7 +109,6 @@ class RootModule(Submodule): previous_commit = repo.commit(previous_commit) # obtain commit object # END handle previous commit - psms = self.list_items(repo, parent_commit=previous_commit) sms = self.list_items(repo) spsms = set(psms) diff --git a/git/objects/submodule/util.py b/git/objects/submodule/util.py index 237321e2..47b45109 100644 --- a/git/objects/submodule/util.py +++ b/git/objects/submodule/util.py @@ -9,22 +9,27 @@ __all__ = ( 'sm_section', 'sm_name', 'mkhead', 'unbare_repo', 'find_first_remote #{ Utilities + def sm_section(name): """:return: section title used in .gitmodules configuration file""" return 'submodule "%s"' % name + def sm_name(section): """:return: name of the submodule as parsed from the section name""" section = section.strip() return section[11:-1] + def mkhead(repo, path): """:return: New branch/head instance""" return git.Head(repo, git.Head.to_full_path(path)) + def unbare_repo(func): """Methods with this decorator raise InvalidGitRepositoryError if they encounter a bare repository""" + def wrapper(self, *args, **kwargs): if self.repo.bare: raise InvalidGitRepositoryError("Method '%s' cannot operate on bare repositories" % func.__name__) @@ -34,6 +39,7 @@ def unbare_repo(func): wrapper.__name__ = func.__name__ return wrapper + def find_first_remote_branch(remotes, branch_name): """Find the remote branch matching the name of the given branch or raise InvalidGitRepositoryError""" for remote in remotes: @@ -51,6 +57,7 @@ def find_first_remote_branch(remotes, branch_name): #{ Classes class SubmoduleConfigParser(GitConfigParser): + """ Catches calls to _write, and updates the .gitmodules blob in the index with the new data, if we have written into a stream. Otherwise it will |