Ejemplo n.º 1
0
 def __init__(self, *args, **kwargs):
     #
     # Work around the GitPython issue #775
     # https://github.com/gitpython-developers/GitPython/issues/775
     #
     self.git_dir = os.path.join(os.getcwd(), ".git")
     Repo.__init__(self, *args, **kwargs)
Ejemplo n.º 2
0
 def __init__(self, **kwargs) -> None:
     """
     1. Set up configuration file.
     2. Inherit git repo attributes
     """
     Configurable.__init__(self, **kwargs)
     Repo.__init__(self, '.')
Ejemplo n.º 3
0
    def __init__(self, rid, rev='HEAD'):
        Repo.__init__(self, os.path.join(settings.REPO_DIR, str(rid)))

        # Store the repo id.
        self.id = rid
        try:
            self.rev = self.commit(rev)
        except BadObject:
            if rev == 'HEAD':
                self.rev = None
            else:
                raise

        # Determine the owner.
        if self.rev:
            cr = self.config_reader('repository')
            self.owner = {
                'email': cr.get('user', 'email'),
                'name': cr.get('user', 'name'),
            }
        else:
            self.owner = None

        # Determine what the main file is.
        self.mainfile = None
        self.files = [entry[0] for entry in self.index.entries.keys()]
        if self.files:
            self.files.remove('title')
            self.mainfile = self.files[0]

        # Determine the language of the main file.
        self.language = None
        if self.mainfile:
            ext = '.' + self.mainfile.rsplit('.')[-1]
            for lang in LANGUAGES.values():
                if ext in lang['extensions']:
                    self.language = lang
                    break

        # Get the commits.
        if self.rev:
            self.commits = [self.commit('HEAD')]
            self.commits += [
                commit for commit in self.commits[0].iter_parents()
            ]
        else:
            self.commits = []
        self.has_history = len(self.commits) > 1

        # Get the tags.
        self.has_releases = len(self.tags) > 0
        self.revtag = None
        if self.rev:
            for tag in self.tags:
                if tag.commit == self.rev:
                    self.revtag = tag
                    break
Ejemplo n.º 4
0
    def __init__(self, rid, rev='HEAD'):
        Repo.__init__(self, os.path.join(settings.REPO_DIR, str(rid)))

        # Store the repo id.
        self.id = rid
        try:
            self.rev = self.commit(rev)
        except BadObject:
            if rev == 'HEAD':
                self.rev = None
            else:
                raise

        # Determine the owner.
        if self.rev:
            cr = self.config_reader('repository')
            self.owner = {
                'email': cr.get('user', 'email'),
                'name': cr.get('user', 'name'),
            }
        else:
            self.owner = None

        # Determine what the main file is.
        self.mainfile = None
        self.files = [entry[0] for entry in self.index.entries.keys()]
        if self.files:
            self.files.remove('title')
            self.mainfile = self.files[0]

        # Determine the language of the main file.
        self.language = None
        if self.mainfile:
            ext = '.' + self.mainfile.rsplit('.')[-1]
            for lang in LANGUAGES.values():
                if ext in lang['extensions']:
                    self.language = lang
                    break

        # Get the commits.
        if self.rev:
            self.commits = [self.commit('HEAD')]
            self.commits += [commit for commit in self.commits[0].iter_parents()]
        else:
            self.commits = []
        self.has_history = len(self.commits) > 1

        # Get the tags.
        self.has_releases = len(self.tags) > 0
        self.revtag = None
        if self.rev:
            for tag in self.tags:
                if tag.commit == self.rev:
                    self.revtag = tag
                    break
Ejemplo n.º 5
0
 def __init__(self):
     Repo.__init__(self, '.')
     self.msg = self.get_commit_message()