@@ -97,52 +97,62 @@ def commit_history_progress_bar
97
97
def migrate_markup_of_latest_revisions
98
98
puts 'Convert latest revisions:' if verbose?
99
99
input_wiki . latest_revisions . each do |revision |
100
- if input_wiki . excluded_pages . include? ( revision . title )
101
- puts "Exclude Page: #{ revision . title } " if verbose?
102
- next
103
- end
104
-
105
- if verbose?
106
- puts "Filter source: #{ revision . title } #{ revision . time } "
107
- else
108
- migrate_markup_progress_bar . increment
109
- end
110
-
111
- migrate_markup_of_revision ( revision )
100
+ convert_markup_of_revision ( revision )
112
101
end
113
102
end
114
103
115
104
def commit_history
116
105
output_wiki . commit_history ( revisions , options ) do |page , index |
117
- if input_wiki . excluded_pages . include? ( page . title )
118
- puts "Exclude Page: #{ page . title } " if verbose?
119
- next
120
- end
121
-
122
- if verbose?
123
- puts "(#{ index + 1 } /#{ revisions_count } ) #{ page . time } #{ page . title } "
124
- else
125
- commit_history_progress_bar . increment
126
- end
106
+ commit_page ( page , index )
127
107
end
128
108
end
129
109
130
- def migrate_markup_of_revision ( revision )
110
+ def commit_page ( page , index )
111
+ if input_wiki . excluded_pages . include? ( page . title )
112
+ puts "Exclude Page: #{ page . title } " if verbose?
113
+ return
114
+ end
115
+
116
+ if verbose?
117
+ puts "(#{ index + 1 } /#{ revisions_count } ) #{ page . time } #{ page . title } "
118
+ else
119
+ commit_history_progress_bar . increment
120
+ end
121
+ end
122
+
123
+ def run_filter_processor_on_revision ( revision )
131
124
body_new = filter_processor . run ( revision . body )
132
125
133
126
return if body_new == revision . body
134
127
135
- message = "Markup of '#{ revision . title } ' converted to #{ target_markup } "
128
+ revision . message = "Markup of '#{ revision . title } ' converted to #{ target_markup } "
129
+
130
+ commit_as_latest_page ( revision )
131
+ end
132
+
133
+ def convert_markup_of_revision ( revision )
134
+ if input_wiki . excluded_pages . include? ( revision . title )
135
+ puts "Exclude Page: #{ revision . title } " if verbose?
136
+ return
137
+ end
138
+
139
+ if verbose?
140
+ puts "Filter source: #{ revision . title } #{ revision . time } "
141
+ else
142
+ migrate_markup_progress_bar . increment
143
+ end
144
+
145
+ run_filter_processor_on_revision ( revision )
146
+ end
136
147
137
- # commit as latest page revision
138
- output_wiki . commit_revision ( build_revision_metadata ( revision , body_new , message ) , options [ :markup ] )
148
+ def commit_as_latest_page ( revision )
149
+ output_wiki . commit_revision ( build_revision_metadata ( revision , body_new ) , options [ :markup ] )
139
150
end
140
151
141
- def build_revision_metadata ( revision , body_new , message )
152
+ def build_revision_metadata ( revision , body_new )
142
153
revision . body = body_new
143
154
revision . author = { name : DEFAULT_AUTHOR_NAME , email : DEFAULT_AUTHOR_EMAIL }
144
- revision . time = Time . now
145
- revision . message = message
155
+ revision . time = Time . zone . now
146
156
147
157
revision
148
158
end
0 commit comments