tractive 1.0.1 → 1.0.2
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.adoc +8 -6
- data/exe/tractive +3 -2
- data/lib/tractive/revmap_generator.rb +22 -9
- data/lib/tractive/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f7da399b45e9e780b66e3da4ed52181b94f9d5ec6c98293d9dc590688f4aa99
|
4
|
+
data.tar.gz: 5e64a51c2cae40d501e02144c2acf0c72076bc04b4344b51fb46f92610a4e3c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f112048a0c429f2f1e901c713dd610dc72955ff0b8eab97d463816ede7a57f3406541ef7c4ad1ae024be5d2ddf33f06d0385a9b54cc446fa4d8fbdae00656b04
|
7
|
+
data.tar.gz: 30da24854a6b49bb38d5075740fc13d5c5a22b53ceca315595b955d63c1450ba93f0fa2509789e6a69186d4cd204033de21fcdec3e39e855c4a18270be40a594
|
data/Gemfile.lock
CHANGED
data/README.adoc
CHANGED
@@ -194,15 +194,17 @@ user interface.
|
|
194
194
|
|
195
195
|
| `--svn-url`
|
196
196
|
|
|
197
|
-
(required
|
198
|
-
|
199
|
-
prefix).
|
197
|
+
(required unless `--svn-local-path` set)
|
198
|
+
SVN repository URL that should be used in RevMap generation. The URL must start
|
199
|
+
with the `http://` or `https://` prefix (not the `svn://` prefix).
|
200
200
|
| String
|
201
201
|
|
202
202
|
| `--svn-local-path`
|
203
|
-
|
|
204
|
-
|
205
|
-
|
203
|
+
|
|
204
|
+
(required unless `-svn-url` set)
|
205
|
+
SVN local repository path that should be used in RevMap generation. You can
|
206
|
+
clone the svn repo locally and provide its local path if the svn repository is
|
207
|
+
offline.
|
206
208
|
| String
|
207
209
|
|
208
210
|
| `--rev-timestamp-file`
|
data/exe/tractive
CHANGED
@@ -5,6 +5,8 @@ require_relative "../lib/tractive"
|
|
5
5
|
|
6
6
|
class TractiveCommand < Thor
|
7
7
|
default_command :migrate
|
8
|
+
class_option "logfile", type: :string, aliases: ["-L", "--log-file"],
|
9
|
+
desc: "Name of the logfile to output logs to."
|
8
10
|
|
9
11
|
desc "<OPTIONS>", "Migrate Trac instances to modern Git management platforms like GitHub and GitLab"
|
10
12
|
method_option "attachmentexporter", type: :string, aliases: ["-A", "--attachment-exporter"],
|
@@ -33,8 +35,6 @@ class TractiveCommand < Thor
|
|
33
35
|
desc: "Import issues from a json file"
|
34
36
|
method_option "info", type: :boolean, aliases: ["-i", "--info"],
|
35
37
|
desc: "Reports existing labels and users in the database"
|
36
|
-
method_option "logfile", type: :string, aliases: ["-L", "--log-file"],
|
37
|
-
desc: "Name of the logfile to output logs to."
|
38
38
|
method_option "mockdeleted", type: :boolean, aliases: ["-M", "--mockup"],
|
39
39
|
desc: "Import from 0 and mocking tickets deleted on trac"
|
40
40
|
method_option "openedonly", type: :boolean, aliases: ["-o", "--opened-only"],
|
@@ -64,6 +64,7 @@ class TractiveCommand < Thor
|
|
64
64
|
def generate_revmap
|
65
65
|
verify_revmap_generator_options!(options)
|
66
66
|
|
67
|
+
Tractive::Utilities.setup_logger(output_stream: options[:log_file] || $stderr, verbose: options[:verbose])
|
67
68
|
Tractive::RevmapGenerator.new(
|
68
69
|
options["revtimestampfile"],
|
69
70
|
options["svnurl"],
|
@@ -11,6 +11,7 @@ module Tractive
|
|
11
11
|
@duplicate_message_commits = {}
|
12
12
|
@last_revision = nil
|
13
13
|
@pinwheel = %w[| / - \\]
|
14
|
+
@skipped = []
|
14
15
|
@output_file = output_file
|
15
16
|
end
|
16
17
|
|
@@ -20,6 +21,7 @@ module Tractive
|
|
20
21
|
|
21
22
|
File.open(@output_file, "w+") do |file|
|
22
23
|
File.foreach(@input_file) do |line|
|
24
|
+
i += 1
|
23
25
|
info = extract_info_from_line(line)
|
24
26
|
next if @last_revision == info[:revision]
|
25
27
|
|
@@ -29,9 +31,10 @@ module Tractive
|
|
29
31
|
percent = ((i.to_f / line_count) * 100).round(2)
|
30
32
|
progress = "=" * (percent.to_i / 2) unless i < 2
|
31
33
|
printf("\rProgress: [%<progress>-50s] %<percent>.2f%% %<spinner>s", progress: progress, percent: percent, spinner: @pinwheel.rotate!.first)
|
32
|
-
i += 1
|
33
34
|
end
|
34
35
|
end
|
36
|
+
|
37
|
+
$logger.info "\n\nFollowing revisions are skipped because they don't have a corresponding git commit. #{@skipped}"
|
35
38
|
end
|
36
39
|
|
37
40
|
private
|
@@ -52,11 +55,13 @@ module Tractive
|
|
52
55
|
# get sha from git api
|
53
56
|
commits = git_commits(info)
|
54
57
|
|
55
|
-
if commits.
|
56
|
-
|
58
|
+
if commits.empty?
|
59
|
+
@skipped << info[:revision]
|
60
|
+
elsif commits.count == 1
|
61
|
+
file.puts "#{info[:revision]} | #{commits.values[0]&.join(",")}"
|
57
62
|
else
|
58
63
|
message = commit_message_from_svn(info[:revision])
|
59
|
-
file.puts "#{info[:revision]} | #{@duplicate_commits[info[:timestamp]][message]
|
64
|
+
file.puts "#{info[:revision]} | #{@duplicate_commits[info[:timestamp]][message]&.join(",")}"
|
60
65
|
end
|
61
66
|
end
|
62
67
|
|
@@ -91,16 +96,24 @@ module Tractive
|
|
91
96
|
end
|
92
97
|
|
93
98
|
def commits_from_git_repo(info)
|
94
|
-
|
99
|
+
shas_command = "git rev-list --after=#{info[:timestamp]} --until=#{info[:timestamp]} --committer=#{info[:author]} --all"
|
100
|
+
shas = Dir.chdir(@git_local_repo_path) do
|
101
|
+
`#{shas_command}`
|
102
|
+
end
|
103
|
+
|
104
|
+
commits_command = "git rev-list --after=#{info[:timestamp]} --until=#{info[:timestamp]} --committer=#{info[:author]} --all --format='medium'"
|
95
105
|
commits = Dir.chdir(@git_local_repo_path) do
|
96
|
-
`#{
|
106
|
+
`#{commits_command}`
|
97
107
|
end
|
98
108
|
|
109
|
+
regex = /#{shas.split("\n").map { |sha| "(?=commit #{sha})" }.join "|"}/
|
110
|
+
|
99
111
|
commits_arr = []
|
100
|
-
commits.split(
|
112
|
+
commits.split(regex).each do |commit_info|
|
101
113
|
commit_hash = {}
|
102
|
-
|
103
|
-
commit_hash[:
|
114
|
+
info = commit_info.split("\n", 4)
|
115
|
+
commit_hash[:sha] = info[0].split.last
|
116
|
+
commit_hash[:message] = info.last.strip.gsub("\n", "").gsub(/\s+/, " ")
|
104
117
|
|
105
118
|
commits_arr << commit_hash
|
106
119
|
end
|
data/lib/tractive/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tractive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|