vclog 1.9.2 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/History.md +40 -0
  3. data/License.txt +1 -6
  4. data/README.md +38 -35
  5. data/lib/vclog/adapters/abstract.rb +3 -8
  6. data/lib/vclog/adapters/git.rb +71 -133
  7. data/lib/vclog/adapters/svn.rb +1 -1
  8. data/lib/vclog/change.rb +8 -8
  9. data/lib/vclog/change_point.rb +0 -1
  10. data/lib/vclog/cli/abstract.rb +2 -2
  11. data/lib/vclog/config.rb +47 -49
  12. data/lib/vclog/core_ext.rb +14 -101
  13. data/lib/vclog/heuristics.rb +6 -6
  14. data/lib/vclog/history_file.rb +10 -3
  15. data/lib/vclog/metadata.rb +1 -16
  16. data/lib/vclog/repo.rb +7 -15
  17. data/lib/vclog/report.rb +10 -5
  18. data/lib/vclog/tag.rb +19 -6
  19. data/lib/vclog/version.rb +3 -0
  20. data/man/man1/vclog-autotag.1.ronn +1 -1
  21. data/man/man1/vclog-bump.1.ronn +1 -1
  22. data/man/man1/vclog-news.1.ronn +2 -2
  23. data/man/man1/vclog-version.1.ronn +1 -1
  24. metadata +111 -91
  25. data/.ruby +0 -55
  26. data/lib/vclog.yml +0 -55
  27. data/man/man1/vclog-autotag.1 +0 -29
  28. data/man/man1/vclog-autotag.1.html +0 -117
  29. data/man/man1/vclog-bump.1 +0 -23
  30. data/man/man1/vclog-bump.1.html +0 -111
  31. data/man/man1/vclog-news.1 +0 -25
  32. data/man/man1/vclog-news.1.html +0 -112
  33. data/man/man1/vclog-version.1 +0 -16
  34. data/man/man1/vclog-version.1.html +0 -100
  35. data/man/man1/vclog.1 +0 -51
  36. data/man/man1/vclog.1.html +0 -131
  37. data/spec/feature_git_changes.rb +0 -58
  38. data/spec/feature_git_history.rb +0 -58
  39. data/spec/feature_hg_changes.rb +0 -58
  40. data/spec/feature_hg_history.rb +0 -58
  41. data/spec/featurettes/repo_creation.rb +0 -64
  42. data/spec/featurettes/shellout.rb +0 -16
  43. data/test/case_metadata.rb +0 -10
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9cc7a6945a99a617bd6a0374187f3f86c24f32e04f03bb328001f75c71b933da
4
+ data.tar.gz: 8033a3eb390daa38d015c1159b2d960cd76b54820a456e5b97a89585b9064d8d
5
+ SHA512:
6
+ metadata.gz: 3ef58ecb224ea05db5d2eaeb2a2a35b4f502fc25b581153cb0889bcb5562c54f0e321fc6c583551b707a3436887750e09128e2e4e95a946aed42ca907603b83c
7
+ data.tar.gz: 30a815a2a2d3c388e6bf2a0080cddbc8f91968edc2b5800f45873726f886256a5a6c7a4593e5e0125880daa4f3880d2eb5dcfa8c397227481197f738b02137af
data/History.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # RELEASE HISTORY
2
2
 
3
+ ## 1.10.0 / 2026-11-24
4
+
5
+ The first release since 2012. It makes VCLog work on current Ruby (2.7
6
+ to 4.0) and with current Facets, RDoc and Git, and fixes a number of
7
+ long-standing bugs. Version 1.9.3 was prepared in 2012 but never
8
+ released; its changes are included here.
9
+
10
+ Changes:
11
+
12
+ * Fix loading with Facets 4, which no longer has `String#tabto` or
13
+ `Enumerable#group_by` files. (#18)
14
+ * Fix release histories putting a tagged commit in the release after
15
+ its own. (#16)
16
+ * Fix reading of Git tags: a tag message beginning with a letter from
17
+ a to f, or a long one, could break `vclog -r`, `vclog-version` and
18
+ `vclog-bump`. (#15)
19
+ * Fix a crash on Git commits that change no files, and on commits and
20
+ tags with an empty message. (#17, thanks to Christopher Fuhrman)
21
+ * The current version is the highest version tag, so 0.10.0 comes
22
+ after 0.9.0, where before it was the last tag by name.
23
+ * `-p` (`--point`) now splits commit messages into points and the
24
+ default doesn't; the two were the wrong way round.
25
+ * `vclog-bump` gives the next patch version when nothing has changed
26
+ since the last release, where before it failed.
27
+ * Find the history file whatever its case (`History.md`, `HISTORY.md`).
28
+ * Find a project's config file (`etc/vclog.rb`, `config/vclog.rb`,
29
+ `.vclog`, ...), which the last code on master failed to do.
30
+ * Fix the HTML format with current RDoc, and ERB templates on Ruby 3.
31
+ * Fix `Heuristics.eval` and `Heuristics#level`, which raised errors.
32
+ * Error messages go to standard error.
33
+ * Git commands are run without a shell.
34
+ * Depend on `ostruct`, `json` and `rdoc`, which are no longer always
35
+ part of Ruby.
36
+ * Remove the RC configuration support that was added for 1.9.3 and
37
+ deprecated before any release.
38
+ * Tests run on Spectrum and Assay, against a Git repository built for
39
+ the purpose, and check what the commands print. Before, they needed
40
+ the network and didn't check anything.
41
+
42
+
3
43
  ## 1.9.2 / 2012-03-03
4
44
 
5
45
  Adds `vclog-news` command to output the lastest release entry in a project History file.
data/License.txt CHANGED
@@ -1,9 +1,4 @@
1
- (BSD-2-Clause License)
2
-
3
- VCLog - Mult-platform VCS Logging Tool
4
- http://rubyworks.github.com/vclog
5
-
6
- Copyright (c) 2008 Rubyworks. All rights reserved.
1
+ BSD-2-Clause License
7
2
 
8
3
  Redistribution and use in source and binary forms, with or without
9
4
  modification, are permitted provided that the following conditions are met:
data/README.md CHANGED
@@ -1,41 +1,44 @@
1
1
  # VCLog
2
2
 
3
- [Website](http://rubyworks.github.com/vclog) /
4
- [Source Code](http://github.com/rubyworks/vclog) /
5
- [Report Issue](http://github.com/rubyworks/vclog/issues) /
6
- [Mailing List](http://googlegroups.com/group/rubyworks-mailinglist)
3
+ [Report Issue](https://github.com/rubyworks/vclog/issues) /
4
+ [Source Code](https://github.com/rubyworks/vclog)    
5
+ [![CI](https://github.com/rubyworks/vclog/actions/workflows/ci.yml/badge.svg)](https://github.com/rubyworks/vclog/actions/workflows/ci.yml)
7
6
 
8
- [![Build Status](https://secure.travis-ci.org/rubyworks/vclog.png)](http://travis-ci.org/rubyworks/vclog)
7
+ **VCLog is a versatile and customizable cross-VCS/SCM changelog and release history generator.**
9
8
 
9
+ ## Supported Systems
10
10
 
11
- ## Description
11
+ VCLog is a multi-platform VCS logging tool.
12
+ It currently supports the following Version Control Systems:
12
13
 
13
- VCLog is a versatile cross-VCS/SCM changelog generator.
14
- It currently supports Git, Hg and (limited) Subversion.
14
+ * <a href="http://git-scm.com/">Git</a>
15
+ * <a href="http://mercurial.selenic.com/">Mercurial</a>
16
+ * <a href="http://subversion.apache.org/">Subversion</a>
15
17
 
18
+ Subversion support is limited however. See Limitations noted below.
19
+ Only Git is covered by the test suite at present.
16
20
 
17
- ## Instruction
21
+ VCLog needs Ruby 2.7 or newer.
22
+
23
+
24
+ ## Instructions
18
25
 
19
26
  ### Creating Changelogs
20
27
 
21
28
  The default output is an ANSI colored GNU-like changelog.
22
29
  From a repository's root directory try:
23
30
 
24
- $ vclog
25
-
26
- The is the same as specifying 'changelog' or 'log'.
27
-
28
- $ vclog log
31
+ $ vclog
29
32
 
30
33
  To generate an a different format use -f:
31
34
 
32
- $ vclog -f xml
35
+ $ vclog -f xml
33
36
 
34
37
  ### Creating Release Histories
35
38
 
36
39
  To get a release history specify `-r`, `--release` or `--history` option.
37
40
 
38
- $ vclog -r
41
+ $ vclog -r
39
42
 
40
43
  Again the default format is an ANSI colored GNU-like text style.
41
44
 
@@ -44,20 +47,20 @@ message is used as the release note. If the underlying SCM doesn't
44
47
  support tag messages than the message of the first commit prior to
45
48
  the tag is used.
46
49
 
47
- See 'vclog help' for more options.
50
+ See `vclog --help` for more options.
48
51
 
49
52
  ### Bumping Versions
50
53
 
51
54
  VCLog can also be used to intelligently bump versions. To see the current
52
55
  tag version:
53
56
 
54
- $ vclog-version
55
- 1.1.0
57
+ $ vclog-version
58
+ 1.1.0
56
59
 
57
60
  To see the next reasonable version based on current changes:
58
61
 
59
- $ vclog-bump
60
- 1.2.0
62
+ $ vclog-bump
63
+ 1.2.0
61
64
 
62
65
  VCLog can determine the appropriate version based on commit level. Any
63
66
  commit with a level greater than 1 will bump the major number, while any
@@ -66,16 +69,12 @@ level only bump the patch level.
66
69
 
67
70
  ### Writing Heuristics
68
71
 
69
- You can configure custom log heuristics for your project. VCLog uses
70
- the {confection gem}[http://rubyworks.github.com/confection] to
71
- handle configuration, and will look for a `.confile` or `Confile` in
72
- which to find a `vclog` section.
72
+ VCLog can be configured to support custom log heuristics to suite the work flow
73
+ of any project. It is recommended that configurations be placed in a project's
74
+ `etc/vclog.rb` file. But `config/vclog.rb` and simply `.vclog` or `vclog.rb`
75
+ also work.
73
76
 
74
- vclog do
75
- ...
76
- end
77
-
78
- Within this block we can define rules via the #on method.
77
+ Within this file rules are defined via the #on method. For example,
79
78
 
80
79
  on /updated? (README|VERSION|MANIFEST)/ do |commit|
81
80
  commit.label = "Adminstrative Changes"
@@ -97,7 +96,7 @@ These rules can also "massage" the commit message.
97
96
 
98
97
  on /\Aadmin:/ do |commit, matchdata|
99
98
  commit.type = :admin
100
- commit.message = matchdate.post_match
99
+ commit.message = matchdata.post_match
101
100
  end
102
101
 
103
102
  Lastly, we can customize the colorization of the certain formats via #colors
@@ -105,6 +104,8 @@ method.
105
104
 
106
105
  colors :blue, :cyan, :green, :yellow, :red
107
106
 
107
+ The colors are taken in order from least importance to greatest importance.
108
+
108
109
 
109
110
  ## Limitations
110
111
 
@@ -118,11 +119,13 @@ access by the server for making too many rapid requests. I have no
118
119
  idea how to remedy this issue. If you have any ideas please let me know.
119
120
 
120
121
 
121
- ## License
122
+ ## Copyrights
122
123
 
123
- Copyright (c) 2008 Rubyworks
124
+ VCLog (https://github.com/rubyworks/vclog)
124
125
 
125
- VCLog is distributable in accordance with the terms of the *FreeBSD* license.
126
+ Copyright &copy; 2008 Rubyworks. All rights reserved.
126
127
 
127
- See License.txt for details.
128
+ VCLog is modifiable and redistributable in accordance with the terms of
129
+ the *BSD-2-Clause* license.
128
130
 
131
+ See License.txt for details.
@@ -73,15 +73,10 @@ module VCLog
73
73
  tags.find{ |t| t.name == name }
74
74
  end
75
75
 
76
- # Returns the current verion string.
76
+ # Returns the current version string: the highest version tag.
77
77
  def version
78
- if tags.last
79
- v = tags[-1].name # TODO: ensure the latest version
80
- v = tags[-2].name if v == 'HEAD'
81
- else
82
- v = '0.0.0'
83
- end
84
- return v
78
+ latest = tags.reject{ |t| t.name == 'HEAD' }.sort.first
79
+ latest ? latest.name : '0.0.0'
85
80
  end
86
81
 
87
82
  # Return the latest commit as of a given date.
@@ -8,137 +8,83 @@ module VCLog
8
8
  #
9
9
  class Git < Abstract
10
10
 
11
- GIT_COMMIT_MARKER = '=====%n'
12
- GIT_FIELD_MARKER = '-----%n'
13
-
14
- RUBY_COMMIT_MARKER = "=====\n"
15
- RUBY_FIELD_MARKER = "-----\n"
11
+ # Fields and records are separated by control characters, which
12
+ # don't turn up in commit messages or file names.
13
+ FIELD = "\x1f"
14
+ RECORD = "\x1e"
16
15
 
17
16
  # Collect changes, i.e. commits.
18
17
  def extract_changes
19
- list = []
20
-
21
- command = 'git log --name-only --pretty=format:"' +
22
- GIT_COMMIT_MARKER +
23
- '%ci' +
24
- GIT_FIELD_MARKER +
25
- '%aN' +
26
- GIT_FIELD_MARKER +
27
- '%H' +
28
- GIT_FIELD_MARKER +
29
- '%s%n%n%b' +
30
- GIT_FIELD_MARKER +
31
- '"'
32
-
33
- changes = `#{command}`.split(RUBY_COMMIT_MARKER)
34
-
35
- changes.shift # throw the first (empty) entry away
36
-
37
- changes.each do |entry|
38
- date, who, id, msg, files = entry.split(RUBY_FIELD_MARKER)
39
- date = Time.parse(date)
40
- files = files.split("\n")
41
- list << Change.new(:id=>id, :date=>date, :who=>who, :msg=>msg, :files=>files)
18
+ format = ['%ci', '%aN', '%H', '%s%n%n%b', ''].join('%x1f')
19
+ output = git('log', '--name-only', "--pretty=format:%x1e#{format}")
20
+
21
+ output.split(RECORD).reject{ |entry| entry.strip.empty? }.map do |entry|
22
+ date, who, id, msg, files = entry.split(FIELD)
23
+ Change.new(
24
+ :id => id,
25
+ :date => Time.parse(date),
26
+ :who => who,
27
+ :msg => msg.to_s.strip,
28
+ :files => files.to_s.split("\n").reject{ |f| f.empty? }
29
+ )
42
30
  end
31
+ end
43
32
 
44
- return list
45
- end
46
-
47
- #
48
- #def extract_files(change_list)
49
- # change_list.each do |change|
50
- # files = `git show --pretty="format:" --name-only #{c.id}`
51
- # files = files.split("\n")
52
- # change.files = files
53
- # end
54
- #end
55
-
56
- # Collect tags.
57
- #
58
- # `git show 1.0` produces:
59
- #
60
- # tag 1.0
61
- # Tagger: 7rans <transfire@gmail.com>
62
- # Date: Sun Oct 25 09:27:58 2009 -0400
63
- #
64
- # version 1.0
65
- # commit
66
- # ...
67
- #
68
- # @todo This code is pretty poor, but it suffices for now.
69
- # And we need not worry about it the future b/c eventually
70
- # we will replace it by using the `amp` or `scm` gem.
33
+ # Collect tags. An annotated tag has its own author, date and
34
+ # message; a lightweight tag takes them from its commit.
71
35
  def extract_tags
72
- list = []
73
- tags = `git tag -l`
74
- tags.split(/\s+/).each do |tag|
75
- next unless version_tag?(tag) # only version tags
76
- id, who, date, rev, msg = nil, nil, nil, nil, nil
77
- info = `git show #{tag}`
78
- info, *_ = info.split(/^(commit|diff|----)/)
79
- if /\Atag/ =~ info
80
- msg = ''
81
- info.lines.to_a[1..-1].each do |line|
82
- case line
83
- when /^Tagger:/
84
- who = $'.strip
85
- when /^Date:/
86
- date = $'.strip
87
- when /^\s*[a-f0-9]+/
88
- id = $0.strip
89
- else
90
- msg << line
91
- end
92
- end
93
- msg = msg.strip
94
-
95
- #info = `git show #{tag}^ --pretty=format:"%ci|~|%H|~|"`
96
- #cdate, id, *_ = *info.split('|~|')
97
-
98
- info = git_show("#{tag}")
36
+ format = %w[
37
+ %(refname:short) %(objecttype) %(objectname) %(*objectname)
38
+ %(taggername) %(taggeremail) %(taggerdate:iso8601) %(contents)
39
+ ].join('%1f') + '%1e'
99
40
 
100
- change = Change.new(info)
41
+ output = git('for-each-ref', "--format=#{format}", 'refs/tags')
101
42
 
102
- list << Tag.new(:id=>change.id, :name=>tag, :date=>date, :who=>who, :msg=>msg, :commit=>change)
103
- else
104
- #info = `git show #{tag} --pretty=format:"%cn|~|%ce|~|%ci|~|%H|~|%s|~|"`
105
- info = git_show(tag)
43
+ list = []
44
+ output.split(RECORD).each do |entry|
45
+ name, type, id, commit_id, who, email, date, msg = entry.sub(/\A\n/, '').split(FIELD)
46
+ next if name.nil? || name.empty?
47
+ next unless version_tag?(name) # only version tags
48
+
49
+ if type == 'tag'
50
+ next if commit_id.to_s.empty? # a tag of something other than a commit
51
+ change = Change.new(git_show(commit_id))
52
+ list << Tag.new(
53
+ :id => change.id,
54
+ :name => name,
55
+ :date => date,
56
+ :who => "#{who} #{email}".strip,
57
+ :msg => msg.to_s.strip,
58
+ :commit => change
59
+ )
60
+ elsif type == 'commit'
61
+ info = git_show(id)
106
62
  change = Change.new(info)
107
-
108
- tag_info = {
109
- :name => tag,
63
+ list << Tag.new(
64
+ :name => name,
110
65
  :who => info[:who],
111
66
  :date => info[:date],
112
67
  :msg => info[:message],
113
68
  :commit => change
114
- }
115
- list << Tag.new(tag_info)
116
- end
117
-
118
- #if $DEBUG
119
- # p who, date, rev, msg
120
- # puts
121
- #end
122
-
123
- #list << tag
69
+ )
70
+ end
124
71
  end
125
-
126
- return list
72
+ list
127
73
  end
128
74
 
129
75
  # User name of developer.
130
76
  def user
131
- @user ||= `git config user.name`.strip
77
+ @user ||= git('config', 'user.name').strip
132
78
  end
133
79
 
134
80
  # Email address of developer.
135
81
  def email
136
- @email ||= `git config user.email`.strip
82
+ @email ||= git('config', 'user.email').strip
137
83
  end
138
84
 
139
85
  #
140
86
  def repository
141
- @repository ||= `git config remote.origin.url`.strip
87
+ @repository ||= git('config', 'remote.origin.url').strip
142
88
  end
143
89
 
144
90
  #
@@ -148,39 +94,31 @@ module VCLog
148
94
  file = tempfile("message", message)
149
95
  date = date.strftime('%Y-%m-%d 23:59') unless String===date
150
96
 
151
- cmd = %[GIT_AUTHOR_DATE='#{date}' GIT_COMMITTER_DATE='#{date}' git tag -a -F '#{file}' #{label} #{ref}]
152
- puts cmd if $DEBUG
153
- `#{cmd}` unless $DRYRUN
97
+ env = {'GIT_AUTHOR_DATE'=>date, 'GIT_COMMITTER_DATE'=>date}
98
+ cmd = ['git', '-C', root.to_s, 'tag', '-a', '-F', file, label.to_s, ref.to_s]
99
+ puts cmd.join(' ') if $DEBUG
100
+ system(env, *cmd) unless $DRYRUN
154
101
  end
155
102
 
156
103
  private
157
104
 
158
- #
159
- #
160
- #
105
+ # Run git in the project's root and return what it prints.
106
+ def git(*args)
107
+ IO.popen(['git', '-C', root.to_s, *args], :err=>File::NULL, &:read).to_s
108
+ end
109
+
110
+ # Details of a single commit.
161
111
  def git_show(ref)
162
- command = 'git show ' + ref.to_s + ' --name-only --pretty=format:"' +
163
- '%ci' +
164
- GIT_FIELD_MARKER +
165
- '%cn' +
166
- GIT_FIELD_MARKER +
167
- '%ce' +
168
- GIT_FIELD_MARKER +
169
- '%H' +
170
- GIT_FIELD_MARKER +
171
- '%s%n%n%b' +
172
- GIT_FIELD_MARKER +
173
- '"'
174
-
175
- entry = `#{command}`
176
-
177
- date, who, email, id, msg, files = entry.split(RUBY_FIELD_MARKER)
178
-
179
- who = who + ' ' + email
180
- date = Time.parse(date)
181
- files = files.split("\n")
182
-
183
- return { :date=>date, :who=>who, :id=>id, :message=>msg, :files=>files }
112
+ format = ['%ci', '%cn', '%ce', '%H', '%s%n%n%b', ''].join('%x1f')
113
+ entry = git('show', '--name-only', "--pretty=format:#{format}", ref.to_s)
114
+
115
+ date, who, email, id, msg, files = entry.split(FIELD)
116
+
117
+ { :date => Time.parse(date),
118
+ :who => "#{who} #{email}",
119
+ :id => id,
120
+ :message => msg.to_s.strip,
121
+ :files => files.to_s.split("\n").reject{ |f| f.empty? } }
184
122
  end
185
123
 
186
124
  end
@@ -135,7 +135,7 @@ module VCLog
135
135
  file = tempfile("message", message)
136
136
 
137
137
  Dir.chdir(root) do
138
- cmd = %[svn copy -r #{ref} -F "#{mfile.path}" . #{tag_directory}/#{label}]
138
+ cmd = %[svn copy -r #{ref} -F "#{file}" . #{tag_directory}/#{label}]
139
139
  puts cmd if $DEBUG
140
140
  `#{cmd}` unless $DRYRUN
141
141
  end
data/lib/vclog/change.rb CHANGED
@@ -12,19 +12,19 @@ module VCLog
12
12
  attr_accessor :id
13
13
 
14
14
  # Date/time of commit.
15
- attr_accessor :date
15
+ attr_reader :date
16
16
 
17
17
  # Committer.
18
- attr_accessor :author
18
+ attr_reader :author
19
19
 
20
20
  # Commit message.
21
- attr_accessor :message
21
+ attr_reader :message
22
22
 
23
23
  # List of files changed in the commit.
24
24
  attr_accessor :files
25
25
 
26
26
  # Type of change, as assigned by hueristics.
27
- attr_accessor :type
27
+ attr_reader :type
28
28
 
29
29
  # The priority level of this change, as assigned by hueristics.
30
30
  # This can be `nil`, as Heuristics will always make sure a
@@ -37,7 +37,7 @@ module VCLog
37
37
  # ANSI color to apply. Actually this can be a list
38
38
  # of any support ansi gem terms, but usually it's
39
39
  # just the color term, such as `:red`.
40
- attr_accessor :color
40
+ attr_reader :color
41
41
 
42
42
  # Setup new Change instance.
43
43
  def initialize(data={})
@@ -69,11 +69,11 @@ module VCLog
69
69
  # Set the commit message.
70
70
  #
71
71
  def message=(msg)
72
- @message = msg
72
+ @message = msg = msg.to_s
73
73
 
74
74
  lines = msg.lines.to_a
75
- @summary = lines.first.strip
76
- @details = lines[1..-1].join('').strip
75
+ @summary = lines.first.to_s.strip
76
+ @details = lines.drop(1).join('').strip
77
77
 
78
78
  msg
79
79
  end
@@ -42,7 +42,6 @@ module VCLog
42
42
  if @change.respond_to?(s)
43
43
  @change.send(s,*a,&b)
44
44
  else
45
- p caller
46
45
  super(s,*a,&b)
47
46
  end
48
47
  end
@@ -21,8 +21,8 @@ module VCLog
21
21
  if $DEBUG
22
22
  raise err
23
23
  else
24
- puts err.message
25
- exit -1
24
+ $stderr.puts err.message
25
+ exit(-1)
26
26
  end
27
27
  end
28
28