vclog 1.6.1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.rdoc CHANGED
@@ -1,5 +1,15 @@
1
1
  = RELEASE HISTORY
2
2
 
3
+ == 1.7.0 / 2010-06-27
4
+
5
+ In this release the heuristics interface has changed such that the block is passed the commit message and the matchdata, instead of the previous matchdata splat. The rule can alos return either the sybolic label or a two element array of label and new message, which allows the rule to "massage" the message as needed. This release also improves the git log parser to be much more robust.
6
+
7
+ Changes:
8
+
9
+ * Pass message and matchadata to heuristics rule interface.
10
+ * Improve git log parser, which should handle all possible cases now.
11
+
12
+
3
13
  == 1.6.1 / 2010-06-23
4
14
 
5
15
  This release repairs the Atom feed format and adds an RSS feed format. Both formats are nearly conformant with strict validations --only a couple minor issues remain to iron out (such as embedded feed url). Ragardless, they should work fine with feed readers (which are not as strict).
data/README.rdoc CHANGED
@@ -12,17 +12,73 @@ It currently supports Git, Hg and (limited) Subversion.
12
12
 
13
13
  == SYNOPSIS
14
14
 
15
- The default format is a ANSI colored GNU-like text style.
15
+ === Creating Changelogs
16
+
17
+ The default output is a ANSI colored GNU-like changelog.
16
18
  From a repository's root directory try:
17
19
 
18
20
  $ vclog
19
21
 
20
- To generate an XML formatted changelog use:
22
+ The is the same as specifying 'changelog' or 'log'.
23
+
24
+ $ vclog log
25
+
26
+ To generate an a different format use -f:
21
27
 
22
28
  $ vclog -f xml
23
29
 
30
+ === Creating Release Histories
31
+
32
+ To get a release history specify 'history' or 'release' as the subcommand.
33
+
34
+ $ vclog history
35
+
36
+ Again the default format is a ANSI colored GNU-like text style.
37
+
38
+ Unlike Changelogs, Histories group changes by tags. The tag message is
39
+ used as the release note. If the underlying SCM doesn't support
40
+ tag messages that the last commit message before the tag is used.
41
+
24
42
  See 'vclog help' for more options.
25
43
 
44
+ === Bumping Versions
45
+
46
+ VCLog can also be used to intelligently bump versions. To see the current
47
+ tag version:
48
+
49
+ $ vclog version
50
+ 1.1.0
51
+
52
+ To see the next reasonable version based on current changes:
53
+
54
+ $ vclog bump
55
+ 1.2.0
56
+
57
+ VCLog can determine the appropriate version based on commit level. Any
58
+ commit with a level greater than 1 will bump the major number, while any
59
+ commit with a level of 0 or 1 will bump the minor number. All lower
60
+ level only bump the patch level.
61
+
62
+ === Writing Heuristics
63
+
64
+ In your projects .vclog/rules.rb or .config/vclog/rules.rb file, you
65
+ can create rules for labeling commit messages bassed on commit message.
66
+
67
+ on /updated? (README|VERSION|MANIFEST)/ do
68
+ :admin
69
+ end
70
+
71
+ These rules can a also "massage" the commit message for output.
72
+
73
+ on /^admin:/ do |matchdata|
74
+ [:admin, matchdate.post_match]
75
+ end
76
+
77
+ Labels are used to categorize and assign levels to commits. Use #set in
78
+ the rules.rb to specify the level and description of a commit label.
79
+
80
+ set :admin, -2, "Administrative Adjustment"
81
+
26
82
 
27
83
  == NOTE ABOUT SUBVSERION
28
84
 
data/VERSION CHANGED
@@ -1,5 +1,5 @@
1
1
  name : vclog
2
2
  major: 1
3
- minor: 6
4
- patch: 1
5
- date : 2010-06-23
3
+ minor: 7
4
+ patch: 0
5
+ date : 2010-06-27
@@ -38,15 +38,16 @@ module Adapters
38
38
  end
39
39
 
40
40
  #
41
+ # TODO: possbile to move heuristics lookup into Change class?
41
42
  def changes
42
43
  @changes ||= (
43
44
  changes = []
44
45
  extract_changes.each do |c|
45
46
  raise "how did this happen?" if Change == c
46
47
  rev, date, who, msg = *c
47
- type, level, label = *heuristics.lookup(msg)
48
+ type, level, label, nmsg = *heuristics.lookup(msg)
48
49
  next if level < self.level
49
- changes << Change.new(rev, date, who, msg, type, level, label)
50
+ changes << Change.new(rev, date, who, nmsg||msg, type, level, label)
50
51
  end
51
52
  changes
52
53
  )
@@ -11,8 +11,8 @@ module Adapters
11
11
  #
12
12
  def extract_changes
13
13
  list = []
14
- changelog = `git log --pretty=format:"---%ci|~|%aN|~|%H|~|%s"`.strip
15
- changes = changelog.split("---")
14
+ changelog = `git log --pretty=format:"\036|||%ci|~|%aN|~|%H|~|%s"`.strip
15
+ changes = changelog.split("\036|||")
16
16
  #changes = changelog.split(/^commit/m)
17
17
  changes.shift # throw the first (empty) entry away
18
18
  changes.each do |entry|
@@ -40,21 +40,34 @@ module Adapters
40
40
  tags = `git tag -l`
41
41
  tags.split(/\s+/).each do |tag|
42
42
  next unless version_tag?(tag) # only version tags
43
+ who, date, rev, msg = nil, nil, nil, nil
43
44
  info = `git show #{tag}`
44
- md = /\Atag(.*?)\n(.*?)^commit/m.match(info)
45
- who, date, *msg = *md[2].split(/\n/)
46
- who = who.split(':')[1].strip
47
- date = date[date.index(':')+1..-1].strip
48
- msg = msg.join("\n")
45
+ info, *_ = info.split(/^(commit|diff|----)/)
46
+ if /\Atag/ =~ info
47
+ msg = ''
48
+ info.lines.to_a[1..-1].each do |line|
49
+ case line
50
+ when /^Tagger:/
51
+ who = $'
52
+ when /^Date:/
53
+ date = $'
54
+ else
55
+ msg << line
56
+ end
57
+ end
58
+ msg = msg.strip
59
+ info = `git show #{tag}^ --pretty=format:"%ci|~|%H|~|"`
60
+ date, rev, *_ = *info.split('|~|')
61
+ else
62
+ info = `git show #{tag} --pretty=format:"%cn|~|%ce|~|%ci|~|%H|~|%s|~|"`
63
+ who, email, date, rev, msg, *_ = *info.split('|~|')
64
+ who = who + ' ' + email
65
+ end
49
66
 
50
- info = `git show #{tag}^ --pretty=format:"%ci|~|%H|~|"`
51
- date, rev, *_ = *info.split('|~|')
52
-
53
- #md = /\Atag(.*?)\n(.*?)^commit/m.match(info)
54
- #_who, _date, *_msg = *md[2].split(/\n/)
55
- #_who = _who.split(':')[1].strip
56
- #_date = _date[_date.index(':')+1..-1].strip
57
- #_msg = _msg.join("\n")
67
+ #if $DEBUG
68
+ # p who, date, rev, msg
69
+ # puts
70
+ #end
58
71
 
59
72
  list << [tag, rev, date, who, msg]
60
73
  end
@@ -22,9 +22,10 @@ module CLI
22
22
  [name.split('::').last.downcase]
23
23
  end
24
24
 
25
- #
25
+ # TODO: change +extra+ to +summarize+ and reverse boolean value.
26
26
  def initialize
27
27
  @options = OpenStruct.new
28
+ @options.extra = true
28
29
  end
29
30
 
30
31
  #
@@ -65,8 +66,8 @@ module CLI
65
66
  parser.on('--title', '-t TITLE', "document title") do |string|
66
67
  options.title = string
67
68
  end
68
- parser.on('--detail', '-d', "provide details") do
69
- options.extra = true
69
+ parser.on('--summarize', '-s', "produce summary output") do
70
+ options.extra = false
70
71
  end
71
72
  parser.on('--id', "include revision id") do
72
73
  options.revision = true
@@ -85,7 +85,7 @@ module VCLog
85
85
 
86
86
  case File.extname(tmp_file)
87
87
  when '.rb'
88
- eval(tmp, binding)
88
+ eval(tmp, binding, tmp_file)
89
89
  when '.erb'
90
90
  erb = ERB.new(tmp, nil, '<>')
91
91
  erb.result(binding)
@@ -27,17 +27,18 @@ module VCLog
27
27
 
28
28
  #
29
29
  def lookup(message)
30
- type = nil
31
- @rules.find{ |rule| type = rule.call(message) }
30
+ type_msg = nil
31
+ @rules.find{|rule| type_msg = rule.call(message)}
32
+ type, msg = *type_msg
32
33
  if type
33
34
  type = type.to_sym
34
35
  if @labels.key?(type)
35
- @labels[type].to_a
36
+ @labels[type].to_a + [msg || message]
36
37
  else
37
- [type, 0, "#{type.to_s.capitalize} Enhancements"]
38
+ [type, 0, "#{type.to_s.capitalize} Enhancements", msg || message]
38
39
  end
39
40
  else
40
- [nil, 0, 'General Enhancements']
41
+ [nil, 0, 'General Enhancements', msg || message]
41
42
  end
42
43
  end
43
44
 
@@ -74,14 +75,23 @@ module VCLog
74
75
 
75
76
  #
76
77
  class Rule
78
+ #
77
79
  def initialize(pattern, &block)
78
80
  @pattern = pattern
79
81
  @block = block
80
82
  end
81
83
 
84
+ # Process the rule.
82
85
  def call(message)
83
- if md = @pattern.match(message)
84
- @block.call(*md[1..-1])
86
+ if matchdata = @pattern.match(message)
87
+ case @block.arity
88
+ when 0
89
+ @block.call
90
+ when 1
91
+ @block.call(matchdata)
92
+ else
93
+ @block.call(message, matchdata)
94
+ end
85
95
  else
86
96
  nil
87
97
  end
@@ -1,20 +1,24 @@
1
1
  set :major, 1, "Major Enhancements"
2
+ set :bug, 0, "Bug Fixes"
2
3
  set :minor, -1, "Minor Enhancements"
4
+ set :doc, -1, "Documentation Changes"
3
5
  set :admin, -2, "Administrative Changes"
4
6
 
5
- on /updated? (README|PROFILE|PACKAGE|VERSION|MANIFEST)/ do
6
- :admin
7
+ on /^(\w+):/ do |msg, md|
8
+ word = md[1]
9
+ [word.to_sym, md.post_match]
7
10
  end
8
11
 
9
- on /bump(ed)? version/ do
10
- :admin
12
+ on /\[(\w+)\]\s*$/ do |msg, md|
13
+ word = md[1]
14
+ [word.to_sym, md.pre_match]
11
15
  end
12
16
 
13
- on /^(\w+):/ do |word|
14
- word.to_sym
17
+ on /updated? (README|PROFILE|PACKAGE|VERSION|MANIFEST)/ do
18
+ :admin
15
19
  end
16
20
 
17
- on /\[(\w+)\]\s*$/ do |word|
18
- word.to_sym
21
+ on /(bump|bumped|prepare) version/ do
22
+ :admin
19
23
  end
20
24
 
data/lib/vclog/history.rb CHANGED
@@ -93,7 +93,6 @@ module VCLog
93
93
  delta << [tag, [last, tag.date]]
94
94
  last = tag.date
95
95
  end
96
-
97
96
  # gather changes for each delta
98
97
  delta.each do |tag, (started, ended)|
99
98
  if started
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vclog
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 6
9
- - 1
10
- version: 1.6.1
8
+ - 7
9
+ - 0
10
+ version: 1.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Thomas Sawyer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-23 00:00:00 -04:00
18
+ date: 2010-06-27 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency