Package animio :: Module setup :: Class _GitMixin
[hide private]
[frames] | no frames]

Class _GitMixin

source code

object --+
         |
        _GitMixin
Known Subclasses:

Provides functionality to add files and folders within a base directory into the root of a git repository of our choice
Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
Allows to configure some details, such as * remote name - name of the remote for which branches should be created/updated
source code
 
add_files_and_commit(self, root_repo, repo, root_dir, root_tag)
Add all files recursively to the index as found below root_dir and commit the index.
source code
 
branch_name(self)
Returns: name of the branch identifying our current release configuration
source code
 
finalize_options(self)
Assure our args are of the correct type
source code
 
item_chooser(self, description, items)
Utility allowing the user to easily select items from the items list :param items: objects that can be converted into a string :return: list of selected items
source code
 
push_to_remotes(self, repo, heads=[], remotes=[])
Push the given branchs to the given remotes.
source code
 
set_head_to(self, repo, head_name)
et our head to point to the given head_name.
source code
 
update_git(self, root_dir)
Put the contents in the root_dir into the configured git repository Its important to note that the actual relative location of root_dir does not matter as long as it is inside the git repository.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
adjust_user_options(cls, options)
Append git specific user options to the given options
source code
Static Methods [hide private]
a new object with type S, a subtype of T
__new__(cls, *args, **kwargs)
Because of our old-style bases, new needs to be overridden to call the object constructor without arguments
source code
Class Variables [hide private]
  branch_suffix = None
  prev_head_name = 'DIST_ORIG_HEAD'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 
Allows to configure some details, such as * remote name - name of the remote for which branches should be created/updated
Overrides: object.__init__

__new__(cls, *args, **kwargs)
Static Method

source code 
Because of our old-style bases, new needs to be overridden to call the object constructor without arguments
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

add_files_and_commit(self, root_repo, repo, root_dir, root_tag)

source code 

Add all files recursively to the index as found below root_dir and commit the index.

As a special ability, we will rewrite their paths and thus add them relative to the root directory, even though the git repository might be on another level. It also sports a simple way to determine whether the commit already exists, so it will not recommit data that has just been committed.

Parameters:
  • root_repo - Repository containing the data of the main project
  • repo - dedicated repository containing the distribution data
Returns:
tuple(root_original_head, (Created)Commit object) The head to which the root repository pointed before we changed it to our distribution head, and the commit object we possible created in the distribution repository

branch_name(self)

source code 
Returns:
name of the branch identifying our current release configuration

push_to_remotes(self, repo, heads=[], remotes=[])

source code 
Push the given branchs to the given remotes. If one of the lists is empty, it the respective items will be queried from the user

set_head_to(self, repo, head_name)

source code 
et our head to point to the given head_name. If possible, update the index to represent the tree the head points to
Returns:
Head named head_name

Note: In the worst case, the head points to non-existing ref, as the repository is still empty

update_git(self, root_dir)

source code 
Put the contents in the root_dir into the configured git repository Its important to note that the actual relative location of root_dir does not matter as long as it is inside the git repository. The later object paths within the git repository will all be relative to root_dir.