Changeset - c04d1d9b6193
[Not reviewed]
beta
0 6 0
Marcin Kuzminski - 13 years ago 2013-03-21 23:56:17
marcin@python-works.com
made git refs filter configurable ref issue #797
- default --all was kept and --branches --tags (or even other variations) is possible to use via .ini file
6 files changed with 25 insertions and 3 deletions:
0 comments (0 inline, 0 general)
development.ini
Show inline comments
 
@@ -89,24 +89,28 @@ use_htsts = false
 
## number of commits stats will parse on each iteration
 
commit_parse_limit = 25
 

	
 
## number of items displayed in lightweight dashboard before paginating is shown
 
dashboard_items = 100
 

	
 
## use gravatar service to display avatars
 
use_gravatar = true
 

	
 
## path to git executable
 
git_path = git
 

	
 
## git rev filter option, --all is the default filter, if you need to
 
## hide all refs in changelog switch this to --branches --tags
 
git_rev_filter=--all
 

	
 
## RSS feed options
 
rss_cut_off_limit = 256000
 
rss_items_per_page = 10
 
rss_include_diff = false
 

	
 
## show hash options for changelog
 
sha_len = 12
 
sha_rev = true
 

	
 

	
 
## alternative_gravatar_url allows you to use your own avatar server application
 
## the following parts of the URL will be replaced
production.ini
Show inline comments
 
@@ -89,24 +89,28 @@ use_htsts = false
 
## number of commits stats will parse on each iteration
 
commit_parse_limit = 25
 

	
 
## number of items displayed in lightweight dashboard before paginating is shown
 
dashboard_items = 100
 

	
 
## use gravatar service to display avatars
 
use_gravatar = true
 

	
 
## path to git executable
 
git_path = git
 

	
 
## git rev filter option, --all is the default filter, if you need to
 
## hide all refs in changelog switch this to --branches --tags
 
git_rev_filter=--all
 

	
 
## RSS feed options
 
rss_cut_off_limit = 256000
 
rss_items_per_page = 10
 
rss_include_diff = false
 

	
 
## show hash options for changelog
 
sha_len = 12
 
sha_rev = true
 

	
 

	
 
## alternative_gravatar_url allows you to use your own avatar server application
 
## the following parts of the URL will be replaced
rhodecode/config/deployment.ini_tmpl
Show inline comments
 
@@ -89,24 +89,28 @@ use_htsts = false
 
## number of commits stats will parse on each iteration
 
commit_parse_limit = 25
 

	
 
## number of items displayed in lightweight dashboard before paginating is shown
 
dashboard_items = 100
 

	
 
## use gravatar service to display avatars
 
use_gravatar = true
 

	
 
## path to git executable
 
git_path = git
 

	
 
## git rev filter option, --all is the default filter, if you need to
 
## hide all refs in changelog switch this to --branches --tags
 
git_rev_filter=--all
 

	
 
## RSS feed options
 
rss_cut_off_limit = 256000
 
rss_items_per_page = 10
 
rss_include_diff = false
 

	
 
## show hash options for changelog
 
sha_len = 12
 
sha_rev = true
 

	
 

	
 
## alternative_gravatar_url allows you to use your own avatar server application
 
## the following parts of the URL will be replaced
rhodecode/lib/vcs/backends/git/changeset.py
Show inline comments
 
@@ -178,26 +178,28 @@ class GitChangeset(BaseChangeset):
 
    def parents(self):
 
        """
 
        Returns list of parents changesets.
 
        """
 
        return [self.repository.get_changeset(parent)
 
                for parent in self._commit.parents]
 

	
 
    @LazyProperty
 
    def children(self):
 
        """
 
        Returns list of children changesets.
 
        """
 
        rev_filter = _git_path = rhodecode.CONFIG.get('git_rev_filter',
 
                                              '--all').strip()
 
        so, se = self.repository.run_git_command(
 
            "rev-list --all --children | grep '^%s'" % self.raw_id
 
            "rev-list %s --children | grep '^%s'" % (rev_filter, self.raw_id)
 
        )
 

	
 
        children = []
 
        for l in so.splitlines():
 
            childs = l.split(' ')[1:]
 
            children.extend(childs)
 
        return [self.repository.get_changeset(cs) for cs in children]
 

	
 
    def next(self, branch=None):
 

	
 
        if branch and self.branch != branch:
 
            raise VCSError('Branch option used on changeset not belonging '
rhodecode/lib/vcs/backends/git/repository.py
Show inline comments
 
@@ -222,25 +222,27 @@ class GitRepository(BaseRepository):
 
                return self._repo
 
        except (NotGitRepository, OSError), err:
 
            raise RepositoryError(err)
 

	
 
    def _get_all_revisions(self):
 
        # we must check if this repo is not empty, since later command
 
        # fails if it is. And it's cheaper to ask than throw the subprocess
 
        # errors
 
        try:
 
            self._repo.head()
 
        except KeyError:
 
            return []
 
        cmd = 'rev-list --all --reverse --date-order'
 
        rev_filter = _git_path = rhodecode.CONFIG.get('git_rev_filter',
 
                                                      '--all').strip()
 
        cmd = 'rev-list %s --reverse --date-order' % (rev_filter)
 
        try:
 
            so, se = self.run_git_command(cmd)
 
        except RepositoryError:
 
            # Can be raised for empty repositories
 
            return []
 
        return so.splitlines()
 

	
 
    def _get_all_revisions2(self):
 
        #alternate implementation using dulwich
 
        includes = [x[1][0] for x in self._parsed_refs.iteritems()
 
                    if x[1][1] != 'T']
 
        return [c.commit.id for c in self._repo.get_walker(include=includes)]
 
@@ -496,25 +498,27 @@ class GitRepository(BaseRepository):
 
        cmd_template = 'log --date-order --reverse --pretty=format:"%H"'
 
        cmd_params = {}
 
        if start_date:
 
            cmd_template += ' --since "$since"'
 
            cmd_params['since'] = start_date.strftime('%m/%d/%y %H:%M:%S')
 
        if end_date:
 
            cmd_template += ' --until "$until"'
 
            cmd_params['until'] = end_date.strftime('%m/%d/%y %H:%M:%S')
 
        if branch_name:
 
            cmd_template += ' $branch_name'
 
            cmd_params['branch_name'] = branch_name
 
        else:
 
            cmd_template += ' --all'
 
            rev_filter = _git_path = rhodecode.CONFIG.get('git_rev_filter',
 
                                                          '--all').strip()
 
            cmd_template += ' %s' % (rev_filter)
 

	
 
        cmd = Template(cmd_template).safe_substitute(**cmd_params)
 
        revs = self.run_git_command(cmd)[0].splitlines()
 
        start_pos = 0
 
        end_pos = len(revs)
 
        if start:
 
            _start = self._get_revision(start)
 
            try:
 
                start_pos = revs.index(_start)
 
            except ValueError:
 
                pass
 

	
test.ini
Show inline comments
 
@@ -89,24 +89,28 @@ use_htsts = false
 
## number of commits stats will parse on each iteration
 
commit_parse_limit = 25
 

	
 
## number of items displayed in lightweight dashboard before paginating is shown
 
dashboard_items = 100
 

	
 
## use gravatar service to display avatars
 
use_gravatar = true
 

	
 
## path to git executable
 
git_path = git
 

	
 
## git rev filter option, --all is the default filter, if you need to
 
## hide all refs in changelog switch this to --branches --tags
 
git_rev_filter=--all
 

	
 
## RSS feed options
 
rss_cut_off_limit = 256000
 
rss_items_per_page = 10
 
rss_include_diff = false
 

	
 
## show hash options for changelog
 
sha_len = 12
 
sha_rev = true
 

	
 

	
 
## alternative_gravatar_url allows you to use your own avatar server application
 
## the following parts of the URL will be replaced
0 comments (0 inline, 0 general)