Selaa lähdekoodia

Add parameter end_date to pass a explicit time range to git

It will pass --after/--before instead of --since if start_date and
end_date is used.
Sascha Girrulat 8 vuotta sitten
vanhempi
commit
1bd4f01597
2 muutettua tiedostoa jossa 13 lisäystä ja 3 poistoa
  1. 5
    1
      doc/gitstats.pod
  2. 8
    2
      gitstats

+ 5
- 1
doc/gitstats.pod Näytä tiedosto

@@ -63,7 +63,11 @@ Project name to show on the generated pages. Default is to use basename of the r
63 63
 
64 64
 =item start_date
65 65
 
66
-Specify a starting date to pass with --since to git.
66
+Specify a starting date to pass with --since to git. If end_date is used it will pass --after to git.
67
+
68
+=item end_date
69
+
70
+Specify a end date to pass with --before to git.
67 71
 
68 72
 =item style
69 73
 

+ 8
- 2
gitstats Näytä tiedosto

@@ -47,7 +47,8 @@ conf = {
47 47
 	'linear_linestats': 1,
48 48
 	'project_name': '',
49 49
 	'processes': 8,
50
-	'start_date': ''
50
+	'start_date': '',
51
+	'end_date': ''
51 52
 }
52 53
 
53 54
 def getpipeoutput(cmds, quiet = False):
@@ -74,8 +75,13 @@ def getpipeoutput(cmds, quiet = False):
74 75
 
75 76
 def getlogrange(defaultrange = 'HEAD', end_only = True):
76 77
 	commit_range = getcommitrange(defaultrange, end_only)
77
-	if len(conf['start_date']) > 0:
78
+	if len(conf['start_date']) > 0 and len(conf['end_date']) > 0:
79
+		return '--after="%s" --before="%s" "%s"' % (conf['start_date'],
80
+							    conf['end_date'],
81
+							    commit_range)
82
+	elif len(conf['start_date']) > 0:
78 83
 		return '--since="%s" "%s"' % (conf['start_date'], commit_range)
84
+
79 85
 	return commit_range
80 86
 
81 87
 def getcommitrange(defaultrange = 'HEAD', end_only = False):