changeset 3561:c04d1d9b6193 beta

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
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 21 Mar 2013 23:56:17 +0100
parents 835d44dd6ed8
children b2728f47b589
files development.ini production.ini rhodecode/config/deployment.ini_tmpl rhodecode/lib/vcs/backends/git/changeset.py rhodecode/lib/vcs/backends/git/repository.py test.ini
diffstat 6 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/development.ini	Thu Mar 21 23:09:34 2013 +0100
+++ b/development.ini	Thu Mar 21 23:56:17 2013 +0100
@@ -98,6 +98,10 @@
 ## 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
--- a/production.ini	Thu Mar 21 23:09:34 2013 +0100
+++ b/production.ini	Thu Mar 21 23:56:17 2013 +0100
@@ -98,6 +98,10 @@
 ## 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
--- a/rhodecode/config/deployment.ini_tmpl	Thu Mar 21 23:09:34 2013 +0100
+++ b/rhodecode/config/deployment.ini_tmpl	Thu Mar 21 23:56:17 2013 +0100
@@ -98,6 +98,10 @@
 ## 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
--- a/rhodecode/lib/vcs/backends/git/changeset.py	Thu Mar 21 23:09:34 2013 +0100
+++ b/rhodecode/lib/vcs/backends/git/changeset.py	Thu Mar 21 23:56:17 2013 +0100
@@ -187,8 +187,10 @@
         """
         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 = []
--- a/rhodecode/lib/vcs/backends/git/repository.py	Thu Mar 21 23:09:34 2013 +0100
+++ b/rhodecode/lib/vcs/backends/git/repository.py	Thu Mar 21 23:56:17 2013 +0100
@@ -231,7 +231,9 @@
             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:
@@ -505,7 +507,9 @@
             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()
--- a/test.ini	Thu Mar 21 23:09:34 2013 +0100
+++ b/test.ini	Thu Mar 21 23:56:17 2013 +0100
@@ -98,6 +98,10 @@
 ## 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