tractive 1.0.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.
- checksums.yaml +7 -0
- data/.github/workflows/main.yml +24 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +47 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +14 -0
- data/LICENSE.md +69 -0
- data/README.adoc +742 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/config.example.yaml +73 -0
- data/db/trac-test.db +0 -0
- data/docker/Dockerfile +19 -0
- data/docker/docker-compose.yml +68 -0
- data/exe/tractive +111 -0
- data/lib/tractive/attachment_exporter.rb +62 -0
- data/lib/tractive/github_api/client/issues.rb +78 -0
- data/lib/tractive/github_api/client/milestones.rb +35 -0
- data/lib/tractive/github_api/client.rb +16 -0
- data/lib/tractive/github_api.rb +3 -0
- data/lib/tractive/graceful_quit.rb +30 -0
- data/lib/tractive/info.rb +46 -0
- data/lib/tractive/main.rb +81 -0
- data/lib/tractive/migrator/converter/trac_to_github.rb +307 -0
- data/lib/tractive/migrator/converter/twf_to_markdown.rb +125 -0
- data/lib/tractive/migrator/converter.rb +3 -0
- data/lib/tractive/migrator/engine/migrate_from_db.rb +95 -0
- data/lib/tractive/migrator/engine/migrate_from_file.rb +100 -0
- data/lib/tractive/migrator/engine/migrate_to_file.rb +68 -0
- data/lib/tractive/migrator/engine.rb +131 -0
- data/lib/tractive/migrator.rb +3 -0
- data/lib/tractive/models/attachment.rb +10 -0
- data/lib/tractive/models/milestone.rb +6 -0
- data/lib/tractive/models/report.rb +6 -0
- data/lib/tractive/models/revision.rb +6 -0
- data/lib/tractive/models/session.rb +6 -0
- data/lib/tractive/models/ticket.rb +36 -0
- data/lib/tractive/models/ticket_change.rb +7 -0
- data/lib/tractive/revmap_generator.rb +111 -0
- data/lib/tractive/trac.rb +16 -0
- data/lib/tractive/utilities.rb +68 -0
- data/lib/tractive/version.rb +5 -0
- data/lib/tractive.rb +29 -0
- data/tractive.gemspec +37 -0
- metadata +189 -0
data/README.adoc
ADDED
@@ -0,0 +1,742 @@
|
|
1
|
+
= Tractive: migrating from Trac to GitHub
|
2
|
+
|
3
|
+
== Purpose
|
4
|
+
|
5
|
+
Tractive is a tool that helps you migrate Trac instances to GitHub.
|
6
|
+
|
7
|
+
Specifically, it converts http://trac.edgewall.org[Trac] tickets into
|
8
|
+
https://github.com/[GitHub] Issues by accessing the Trac database's issues and
|
9
|
+
posts the change history of each ticket as issue comments.
|
10
|
+
|
11
|
+
Tractive is written using re-tooled code based on the excellent
|
12
|
+
https://github.com/mavam/trac-hub[trac-hub] migration tool.
|
13
|
+
|
14
|
+
NOTE: This tool was created in order to perform Trac-to-GitHub migration
|
15
|
+
for the https://www.ietf.org/[IETF].
|
16
|
+
|
17
|
+
|
18
|
+
== Installation
|
19
|
+
|
20
|
+
=== Prerequisites
|
21
|
+
|
22
|
+
. Ruby
|
23
|
+
. https://git-scm.com/book/en/v2/Getting-Started-Installing-Git[Git]
|
24
|
+
. http://www.catb.org/~esr/reposurgeon/[`reposurgeon`], which works on Linux
|
25
|
+
(manual compile recommended for the latest versions) and macOS (use Homebrew)
|
26
|
+
. `trac-admin` must be installed in order to extract Trac attachments
|
27
|
+
|
28
|
+
=== Steps
|
29
|
+
|
30
|
+
Install it via:
|
31
|
+
|
32
|
+
[source,sh]
|
33
|
+
----
|
34
|
+
$ gem install tractive
|
35
|
+
----
|
36
|
+
|
37
|
+
|
38
|
+
== Usage
|
39
|
+
|
40
|
+
=== Prerequisites
|
41
|
+
|
42
|
+
. A https://github.com/[GitHub] Account as the importer
|
43
|
+
|
44
|
+
|
45
|
+
=== Steps to migrate from Trac to GitHub
|
46
|
+
|
47
|
+
. Migrate your Trac-managed SVN repositories to GitHub. (<<migrate-svn>>)
|
48
|
+
|
49
|
+
. Build the SVN Revision to Git Commit RevMap. (<<build-map>>)
|
50
|
+
|
51
|
+
. Bootstrap your Tractive config file. (<<bootstrap-config>>)
|
52
|
+
|
53
|
+
. Configure mapping in your Tractive config file. (<<create-config>>)
|
54
|
+
|
55
|
+
. Run Tractive (<<running-tractive>>)
|
56
|
+
+
|
57
|
+
[source,sh]
|
58
|
+
----
|
59
|
+
$ tractive <options>
|
60
|
+
----
|
61
|
+
|
62
|
+
|
63
|
+
[[migrate-svn]]
|
64
|
+
=== Migrating SVN to GitHub using `reposurgeon`
|
65
|
+
|
66
|
+
`reposurgeon` is the leading tool today (and under active development)
|
67
|
+
that allows conversion among multiple version control systems.
|
68
|
+
|
69
|
+
We strongly recommend you to use the excellent `reposurgeon` for this task.
|
70
|
+
|
71
|
+
In the case of Trac to GitHub, we are mostly looking at SVN to Git.
|
72
|
+
|
73
|
+
NOTE: For further details, please see the
|
74
|
+
http://www.catb.org/~esr/reposurgeon/repository-editing.html[reposurgeon guide].
|
75
|
+
|
76
|
+
|
77
|
+
Typically these are the steps to take:
|
78
|
+
|
79
|
+
. In an empty directory, run `repotool --initialize {name-of-repo}`.
|
80
|
+
Enter that the source VCS is `svn`, the destination is `git`.
|
81
|
+
The directory will then be populated with a number of files, including:
|
82
|
+
|
83
|
+
** `Makefile` includes multiple useful tasks, requires user configuration.
|
84
|
+
|
85
|
+
** `{name-of-repo}.lift`, a file to store `reposurgeon` conversion configuration.
|
86
|
+
|
87
|
+
** `{name-of-repo}.map`, a `reposurgeon` specific map of SVN users to GitHub users/emails)
|
88
|
+
|
89
|
+
** `{name-of-repo}.opts`, to enter pre-read `reposurgeon` options.
|
90
|
+
|
91
|
+
. Customize these lines of the `Makefile` with the SVN URL and reposurgeon "read
|
92
|
+
options":
|
93
|
+
+
|
94
|
+
[source,make]
|
95
|
+
----
|
96
|
+
REMOTE_URL = https://svn.ietf.org/svn/tools/mailarch
|
97
|
+
READ_OPTIONS = --branchify=trunk:branch/*:personal/*/*:tags/*:*
|
98
|
+
----
|
99
|
+
|
100
|
+
. Update the `{name-of-repo}.lift` with additional reposurgeon commands (see the
|
101
|
+
reference guide) if necessary. e.g.
|
102
|
+
+
|
103
|
+
[source]
|
104
|
+
----
|
105
|
+
branch rename refs/heads/master refs/heads/main
|
106
|
+
|
107
|
+
msgin --create <<EOF
|
108
|
+
Tag-Name: git-conversion
|
109
|
+
Tagger: IETF Bot <noreply@ietf.org> America/Los_Angeles
|
110
|
+
|
111
|
+
Marks the spot where this repository was migrated from Subversion to git.
|
112
|
+
EOF
|
113
|
+
----
|
114
|
+
|
115
|
+
. Download the SVN repository in mirror mode to the `{name-of-repo}-mirror/`
|
116
|
+
directory. This is necessary for faster processing and so that reposurgeon
|
117
|
+
won't attempt to download from the `REMOTE_URL`.
|
118
|
+
|
119
|
+
. Generate the user map from the SVN repository with `make stubmap`.
|
120
|
+
Edit the `{name-of-repo}.map` to correct/fix it if necessary.
|
121
|
+
|
122
|
+
. Run `make` to generate `{name-of-repo}.svn` and `{name-of-repo}.fo`.
|
123
|
+
The resulting Git repository will be at `{name-of-repo}-git/`.
|
124
|
+
|
125
|
+
. The `{name-of-repo}.fo` file is a SVN Revision to timestamp mapping.
|
126
|
+
Tractive uses this file to build the SVN Revision to Git Commit SHA hash
|
127
|
+
mapping.
|
128
|
+
|
129
|
+
|
130
|
+
[[build-map]]
|
131
|
+
=== Building the Trac Revision to Git Commit RevMap
|
132
|
+
|
133
|
+
RevMap is a mapping file that contains a one-to-many mapping
|
134
|
+
of an SVN revision number to its corresponding Git commit SHA hash(es).
|
135
|
+
|
136
|
+
NOTE: An SVN revision may map to multiple, identical Git commits; see
|
137
|
+
`reposurgeon` documentation for more details.
|
138
|
+
|
139
|
+
With the `{name-of-repo}.fo` file generated by `reposurgeon` (or any other tool
|
140
|
+
for that matter, as long as the format is identical), we can build the SVN
|
141
|
+
revision to Git commit SHA "RevMap".
|
142
|
+
|
143
|
+
A typical `{name-of-repo}.fo` file looks like this:
|
144
|
+
|
145
|
+
[source]
|
146
|
+
----
|
147
|
+
SVN:9 2012-10-10T23:50:08Z!rcross@amsl.com
|
148
|
+
SVN:10 2012-10-10T23:50:56Z!rcross@amsl.com
|
149
|
+
SVN:12 2012-10-10T23:52:56Z!rcross@amsl.com
|
150
|
+
SVN:13 2012-10-10T23:52:56Z!rcross@amsl.com
|
151
|
+
...
|
152
|
+
SVN:33 2013-02-07T04:01:56Z!rcross@amsl.com
|
153
|
+
SVN:34 2013-02-12T17:46:48Z!rcross@amsl.com
|
154
|
+
SVN:35.2 2013-02-12T20:15:49Z!henrik@levkowetz.com
|
155
|
+
...
|
156
|
+
----
|
157
|
+
|
158
|
+
The left column is the SVN revision, while the right column provides a timestamp
|
159
|
+
for which you can find with Git. If you enter `{name-of-repo}-git/`, you can use
|
160
|
+
the `git scommit` and `git scommits` commands (defined in the `reposurgeon`
|
161
|
+
guide) to view the corresponding Git commit(s).
|
162
|
+
|
163
|
+
Notice that:
|
164
|
+
|
165
|
+
* typically there is a single timestamp per SVN Revision. In this case each
|
166
|
+
timestamp can be identified with one Git commit via `git scommit {timestamp}`.
|
167
|
+
|
168
|
+
* sometimes two SVN revisions have identical timestamps. In this case you will
|
169
|
+
need to use `git scommits {timestamp}` to see all these commits.
|
170
|
+
|
171
|
+
* sometimes one SVN revision maps to multiple Git commits. In this case you will
|
172
|
+
need to use `git scommits {timestamp}` to see all these commits.
|
173
|
+
|
174
|
+
With this information you can now build the RevMap with:
|
175
|
+
|
176
|
+
[source,sh]
|
177
|
+
----
|
178
|
+
tractive generate-revmap \
|
179
|
+
--svn-url <url of the SVN repository> \
|
180
|
+
--rev-timestamp-file <reposurgeon timestamp map, e.g. {name-of-repo}.fo> \
|
181
|
+
--git-local-repo-path <path to converted Git repository, e.g. {name-of-repo}-git> \
|
182
|
+
--revmap-output-file <output path of RevMap.txt>
|
183
|
+
----
|
184
|
+
|
185
|
+
The generated RevMap will be then used in a Tractive run so that the migrated
|
186
|
+
issues and commits will replace references to SVN revisions with the
|
187
|
+
corresponding Git commit SHA, enabling GitHub to expose those linkages in the
|
188
|
+
user interface.
|
189
|
+
|
190
|
+
.Options for `tractive generate-revmap` command
|
191
|
+
[cols="3a,5a,2a",options="header"]
|
192
|
+
|===
|
193
|
+
| Option | Description | Type
|
194
|
+
|
195
|
+
| `--svn-url`
|
196
|
+
|
|
197
|
+
(required) SVN repository URL that should be used in RevMap generation.
|
198
|
+
The URL must start with the `http://` or `https://` prefix (not the `svn://`
|
199
|
+
prefix).
|
200
|
+
| String
|
201
|
+
|
202
|
+
| `--svn-local-path`
|
203
|
+
| SVN local repository path that should be used in RevMap generation. You can clone
|
204
|
+
the svn repo locally and provide its local path if the svn repository is offline. (`--svn-url` is not
|
205
|
+
required if this option is given).
|
206
|
+
| String
|
207
|
+
|
208
|
+
| `--rev-timestamp-file`
|
209
|
+
|
|
210
|
+
(required) Specify the input file that contains SVN revision and timestamps that
|
211
|
+
should be used in RevMap generation. The format of the file must follow the
|
212
|
+
`reposurgeon` `.fo` format.
|
213
|
+
|
214
|
+
| String
|
215
|
+
|
216
|
+
| `--git-local-repo-path`
|
217
|
+
|
|
218
|
+
(required) Local Git repository path that should be used in RevMap generation.
|
219
|
+
The path must be a Git repository with a `.git` folder within.
|
220
|
+
| String
|
221
|
+
|
222
|
+
| `--revmap-output-file`
|
223
|
+
| (required) Output file path to save the generated RevMap.
|
224
|
+
| String
|
225
|
+
|
226
|
+
|===
|
227
|
+
|
228
|
+
|
229
|
+
[[bootstrap-config]]
|
230
|
+
=== Boostrapping the Tractive configuration file
|
231
|
+
|
232
|
+
==== General
|
233
|
+
|
234
|
+
Tractive uses a YAML configuration file that contains configuration to export
|
235
|
+
data from Trac and then import to GitHub.
|
236
|
+
|
237
|
+
==== Setting up the configuration file
|
238
|
+
|
239
|
+
Copy the link:config.example.yaml[example YAML configuration] and adapt it
|
240
|
+
as necessary:
|
241
|
+
|
242
|
+
[source,sh]
|
243
|
+
----
|
244
|
+
cp config.example.yaml config.yaml
|
245
|
+
vi config.yaml
|
246
|
+
----
|
247
|
+
|
248
|
+
Then, at a minimum, you need to setup the following sections for
|
249
|
+
bootstrapping (the next step) to work:
|
250
|
+
|
251
|
+
. Trac configuration (<<config-trac>>)
|
252
|
+
|
253
|
+
. GitHub configuration (<<config-github>>)
|
254
|
+
|
255
|
+
|
256
|
+
[[gather-info]]
|
257
|
+
==== Bootstrapping the configuration file with information
|
258
|
+
|
259
|
+
The Tractive configuration file is used to perform the actual migration actions,
|
260
|
+
and therefore depends heavily on the contents of the content to be migrated.
|
261
|
+
|
262
|
+
Tractive can read certain information from the Trac database to allow for
|
263
|
+
easier mapping of users, labels and milestones.
|
264
|
+
|
265
|
+
The following command provides that information.
|
266
|
+
|
267
|
+
[source,sh]
|
268
|
+
----
|
269
|
+
tractive -i
|
270
|
+
----
|
271
|
+
|
272
|
+
|
273
|
+
[[create-config]]
|
274
|
+
=== Working with the Tractive configuration file, and mapping
|
275
|
+
|
276
|
+
The configuration file contains the following sections.
|
277
|
+
|
278
|
+
[[config-trac]]
|
279
|
+
==== Trac configuration
|
280
|
+
|
281
|
+
`trac:`:: (mandatory) Trac (data source) configuration options.
|
282
|
+
|
283
|
+
`database:`::: Database access URL. The database URL follows the
|
284
|
+
http://sequel.jeremyevans.net/rdoc/classes/Sequel.html#method-c-connect[Sequel scheme].
|
285
|
+
SQLite, MySQL, Postgres endpoints supported.
|
286
|
+
|
287
|
+
`ticketbaseurl:`::: URL of the Trac "tickets" interface.
|
288
|
+
|
289
|
+
EXAMPLE:
|
290
|
+
|
291
|
+
[source,yaml]
|
292
|
+
----
|
293
|
+
trac:
|
294
|
+
# For MySQL: mysql2://user:password@host:port/database
|
295
|
+
database: sqlite://db/trac.db
|
296
|
+
ticketbaseurl: https://example.org/trac/foobar/ticket
|
297
|
+
----
|
298
|
+
|
299
|
+
[[config-github]]
|
300
|
+
==== GitHub configuration
|
301
|
+
|
302
|
+
`github:`:: (mandatory) GitHub (migration target) configuration options.
|
303
|
+
|
304
|
+
`repo:`::: Target GitHub organization and repo name as `{github-org}/{repo-name}`.
|
305
|
+
|
306
|
+
`token:`::: Personal Access Token of the GitHub user used to import.
|
307
|
+
This token can be generated under GitHub
|
308
|
+
https://github.com/settings/tokens[Settings > Personal Access Tokens].
|
309
|
+
e.g. 'ghp_fpsc4de1f0c46e01576810740c9242097cba4619486'.
|
310
|
+
|
311
|
+
`local_repo_path:`::: Local path to the migrated Git repository.
|
312
|
+
e.g. '/Users/user/repo-git'.
|
313
|
+
|
314
|
+
`revmap_path:`::: Local path to the RevMap file generated via the
|
315
|
+
`tractive generate-revmap` command.
|
316
|
+
|
317
|
+
|
318
|
+
EXAMPLE:
|
319
|
+
|
320
|
+
[source,yaml]
|
321
|
+
----
|
322
|
+
github:
|
323
|
+
repo: 'example-org/target-repository'
|
324
|
+
token: 'ghp_fpsc4de1f0c46e01576810740c9242097cba4619486'
|
325
|
+
local_repo_path: '/Users/user/repo-git'
|
326
|
+
revmap_path: ./example-revmap.txt
|
327
|
+
----
|
328
|
+
|
329
|
+
|
330
|
+
==== Attribute/Label mapping
|
331
|
+
|
332
|
+
Since GitHub's issue tracker does not have a first-class notion of ticket
|
333
|
+
priority, type, and version information, Tractive supports expressing these in
|
334
|
+
the form of labels.
|
335
|
+
|
336
|
+
The pattern of a mapping is like:
|
337
|
+
+
|
338
|
+
----
|
339
|
+
{trac-ticket-type}:
|
340
|
+
{trac-ticket-type-value}: {github-label-value}
|
341
|
+
----
|
342
|
+
|
343
|
+
`labels:`:: provides custom label mappings.
|
344
|
+
|
345
|
+
`type:`::: Type of the Trac ticket. e.g.
|
346
|
+
+
|
347
|
+
[source,yaml]
|
348
|
+
----
|
349
|
+
defect: defect
|
350
|
+
task: task
|
351
|
+
enhancement: feature request
|
352
|
+
cleanup: cleanup
|
353
|
+
----
|
354
|
+
|
355
|
+
`component:`::: Component of the Trac ticket. e.g.
|
356
|
+
+
|
357
|
+
[source,yaml]
|
358
|
+
----
|
359
|
+
configuration: conf
|
360
|
+
documentation: doc
|
361
|
+
----
|
362
|
+
|
363
|
+
`resolution:`::: Resolution of the Trac ticket. e.g.
|
364
|
+
+
|
365
|
+
[source,yaml]
|
366
|
+
----
|
367
|
+
fixed: fixed
|
368
|
+
invalid: invalid
|
369
|
+
wontfix: wontfix
|
370
|
+
duplicate: duplicated
|
371
|
+
worksforme: worksforme
|
372
|
+
obe: obe
|
373
|
+
----
|
374
|
+
|
375
|
+
`platform:`::: Platform related to the Trac ticket. e.g.
|
376
|
+
+
|
377
|
+
[source,yaml]
|
378
|
+
----
|
379
|
+
Linux: Linux
|
380
|
+
Windows: Windows
|
381
|
+
----
|
382
|
+
|
383
|
+
`severity:`::: Severity of the Trac ticket. (also called Priority in Trac) e.g.
|
384
|
+
+
|
385
|
+
[source,yaml]
|
386
|
+
----
|
387
|
+
blocker: '#blocker'
|
388
|
+
critical: '#critical'
|
389
|
+
major: '#major'
|
390
|
+
medium: '#medium'
|
391
|
+
minor: '#minor'
|
392
|
+
trivial: '#easy'
|
393
|
+
waiting: '#pending'
|
394
|
+
n/a:
|
395
|
+
----
|
396
|
+
|
397
|
+
`priority:`::: Priority of the Trac ticket.
|
398
|
+
+
|
399
|
+
[source,yaml]
|
400
|
+
----
|
401
|
+
Low: '@low'
|
402
|
+
High: '@high'
|
403
|
+
----
|
404
|
+
|
405
|
+
|
406
|
+
==== User mapping
|
407
|
+
|
408
|
+
`users:`:: a one-to-one mapping between Trac usernames or email addresses to
|
409
|
+
GitHub usernames for users, in the following pattern:
|
410
|
+
+
|
411
|
+
[source,yaml]
|
412
|
+
----
|
413
|
+
users:
|
414
|
+
{Trac email or username}: {username on GitHub}
|
415
|
+
...
|
416
|
+
----
|
417
|
+
|
418
|
+
EXAMPLE:
|
419
|
+
|
420
|
+
[source,yaml]
|
421
|
+
----
|
422
|
+
users:
|
423
|
+
matthew@example.org: example-matt
|
424
|
+
valencia: example-vale
|
425
|
+
----
|
426
|
+
|
427
|
+
==== Milestone mapping
|
428
|
+
|
429
|
+
`milestones:`:: mapping of milestones.
|
430
|
+
|
431
|
+
`{milestone-name}:`::: ID of the milestone.
|
432
|
+
`name:`:::: Name of the milestone.
|
433
|
+
`due:`:::: Due date in POSIX msec.
|
434
|
+
`completed:`:::: Date of completion in POSIX msec.
|
435
|
+
`description:`:::: Description of the milestone
|
436
|
+
|
437
|
+
EXAMPLE:
|
438
|
+
|
439
|
+
[source,yaml]
|
440
|
+
----
|
441
|
+
milestones:
|
442
|
+
'2021_02':
|
443
|
+
name: '2021_02'
|
444
|
+
due: 1392595200000000
|
445
|
+
completed: 1415959156000000
|
446
|
+
description: ''
|
447
|
+
----
|
448
|
+
|
449
|
+
|
450
|
+
==== Attachments migration configuration
|
451
|
+
|
452
|
+
`attachments:`:: specifies method of obtaining attachments from Trac.
|
453
|
+
|
454
|
+
`url:`::: URL to obtain Trac attachments from
|
455
|
+
|
456
|
+
`export_folder:`::: folder where the attachments will be downloaded to from Trac.
|
457
|
+
|
458
|
+
`export_script:`::: output of a script that utilizes `trac-admin` to download
|
459
|
+
all attachments from Trac.
|
460
|
+
|
461
|
+
[source,yaml]
|
462
|
+
----
|
463
|
+
attachments:
|
464
|
+
url: https://abc.com/raw-attachment/ticket
|
465
|
+
export_folder: ./attachments
|
466
|
+
export_script: attachments.sh
|
467
|
+
----
|
468
|
+
|
469
|
+
By using the <<gather-info,`-i` option>>, you can easily produce a YAML file
|
470
|
+
with labels, users, milestones etc. You can copy the output into the
|
471
|
+
`config.yaml` file and adapt it as required.
|
472
|
+
|
473
|
+
Once the command is completed you should run `attachments.sh` to export the
|
474
|
+
attachments.
|
475
|
+
|
476
|
+
|
477
|
+
[[running-tractive]]
|
478
|
+
=== Running Tractive
|
479
|
+
|
480
|
+
Thereafter just invoke `tractive` to read from the default `config.yaml` path:
|
481
|
+
|
482
|
+
[source,sh]
|
483
|
+
----
|
484
|
+
tractive
|
485
|
+
----
|
486
|
+
|
487
|
+
By default, `tractive` assumes the file `config.yaml` to be in the same
|
488
|
+
directory as the command was run.
|
489
|
+
|
490
|
+
You can also specify the configuration file on the command line:
|
491
|
+
[source,sh]
|
492
|
+
----
|
493
|
+
tractive -c foo.yaml
|
494
|
+
----
|
495
|
+
|
496
|
+
|
497
|
+
=== Filtering Trac tickets by status
|
498
|
+
|
499
|
+
Add the `-o` flag to only import the tickets that are not in a `closed`
|
500
|
+
status:
|
501
|
+
|
502
|
+
[source,sh]
|
503
|
+
----
|
504
|
+
tractive -o
|
505
|
+
----
|
506
|
+
|
507
|
+
=== Single post mode
|
508
|
+
|
509
|
+
If you want all Trac comments and changes within one Trac ticket to be compiled
|
510
|
+
into a single issue at GitHub:
|
511
|
+
|
512
|
+
[source,sh]
|
513
|
+
----
|
514
|
+
tractive -S
|
515
|
+
----
|
516
|
+
|
517
|
+
|
518
|
+
=== Resuming Trac ticket import
|
519
|
+
|
520
|
+
To resume the migration at a given Trac ticket ID, use `-s`:
|
521
|
+
|
522
|
+
[source,sh]
|
523
|
+
----
|
524
|
+
tractive -s 42
|
525
|
+
----
|
526
|
+
|
527
|
+
|
528
|
+
=== Matching Trac ticket IDs and GitHub issues IDs
|
529
|
+
|
530
|
+
You may want to ensure that the imported Trac ticket IDs are identical to the
|
531
|
+
GitHub Issues ID. This section applies when migrating to an existing or empty
|
532
|
+
GitHub repository,
|
533
|
+
|
534
|
+
Tractive can help you create dummy tickets (and close them) for IDs missing in
|
535
|
+
Trac (because they were deleted). This works even if you run it multiple times.
|
536
|
+
|
537
|
+
[source,sh]
|
538
|
+
----
|
539
|
+
tractive -M
|
540
|
+
----
|
541
|
+
|
542
|
+
NOTE: When converting your Trac setup to GitHub, it is prudent to first try the
|
543
|
+
migration into a test repository which you can delete afterwards. If the run was
|
544
|
+
smooth and delivers the expected results, you can re-run the migration for the
|
545
|
+
real target repository.
|
546
|
+
|
547
|
+
As the process can be interrupted, you can always specify the first ID number
|
548
|
+
to migrate. In this case you need to provide the `-s` argument for the first ID
|
549
|
+
not available in Github.
|
550
|
+
|
551
|
+
[source,sh]
|
552
|
+
----
|
553
|
+
tractive -M -s 601
|
554
|
+
----
|
555
|
+
|
556
|
+
|
557
|
+
=== Fast issue import
|
558
|
+
|
559
|
+
By default, Tractive will verify that the created issue numbers match the ticket
|
560
|
+
IDs of the corresponding Trac ticket and error-exit if the numbers do not match.
|
561
|
+
|
562
|
+
The *fast import* option allows you to disable this safe-checking behavior.
|
563
|
+
|
564
|
+
In order to utilize this feature, you should also disable user interactions by
|
565
|
+
setting **Limit to repository collaborators** under your repository
|
566
|
+
settings. Alternatively, when migrating issues to a new repository,
|
567
|
+
import the issues on a test-repository and rename the repository to the
|
568
|
+
final name when the import went satisfactory.
|
569
|
+
|
570
|
+
You can disable this check by using the *fast* option:
|
571
|
+
|
572
|
+
[source,sh]
|
573
|
+
----
|
574
|
+
tractive -F
|
575
|
+
----
|
576
|
+
|
577
|
+
In effect your import will be much faster since there is no ID synchronization
|
578
|
+
(but after the script has finished, it can still take some time until the issues
|
579
|
+
are created on github).
|
580
|
+
|
581
|
+
If you know that the ticket IDs will not match, e.g. there are existing GitHub issues
|
582
|
+
that are not created by import, using the fast import option is obligatory.
|
583
|
+
In this case, you must specify the ID of the first Trac ticket to be migrated
|
584
|
+
(even if it is 1):
|
585
|
+
|
586
|
+
[source,sh]
|
587
|
+
----
|
588
|
+
tractive -F -s 1
|
589
|
+
----
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
== References
|
594
|
+
|
595
|
+
=== Command line options
|
596
|
+
|
597
|
+
[cols="3a,5a,2a",options="header"]
|
598
|
+
|===
|
599
|
+
| Option | Description | Type
|
600
|
+
|
601
|
+
| `-A`, `--attachment-exporter`
|
602
|
+
| Generate an attachment exporter script according to `config.yaml`.
|
603
|
+
| String
|
604
|
+
|
605
|
+
| `-a`, `--attachment-url`
|
606
|
+
| Add URL to Cloud Host where attachment files are available.
|
607
|
+
| String
|
608
|
+
|
609
|
+
| `-c`
|
610
|
+
| Set the configuration file. Default value: `tractive.config.yaml`.
|
611
|
+
| String
|
612
|
+
|
613
|
+
| `-d`, `--dry-run`
|
614
|
+
| Write exported data to a local file instead of pushing it to Github.
|
615
|
+
| Boolean
|
616
|
+
|
617
|
+
| `-e`, `--export-attachments`
|
618
|
+
| Export attachments from the database according to `config.yaml`.
|
619
|
+
| String
|
620
|
+
|
621
|
+
| `-F`, `--fast-import`
|
622
|
+
| Import without safety-checking GitHub issue numbers.
|
623
|
+
| Boolean
|
624
|
+
|
625
|
+
| `-f`, `--filter`
|
626
|
+
|
|
627
|
+
Filter Trac tickets that you want to import.
|
628
|
+
|
629
|
+
The following options are allowed (at least one necessary):
|
630
|
+
|
631
|
+
* `column-name`
|
632
|
+
* `operator`
|
633
|
+
* `column-value`
|
634
|
+
|
635
|
+
| Boolean
|
636
|
+
|
637
|
+
| `--column-name`
|
638
|
+
| Name of the column to filter.
|
639
|
+
| String
|
640
|
+
|
641
|
+
| `--operator`
|
642
|
+
| Operator for filter. Example of operators include `LIKE` and `=`.
|
643
|
+
| String
|
644
|
+
|
645
|
+
| `--column-value`
|
646
|
+
| Value of the column to filter.
|
647
|
+
| String
|
648
|
+
|
649
|
+
| `-h`, `help`
|
650
|
+
| Display the Tractive help message, or you can provide a command to know more
|
651
|
+
about a single command via `tractive help {command}`.
|
652
|
+
| N/A
|
653
|
+
|
654
|
+
| `-I <path>`, `--import-from-file=<path>`
|
655
|
+
| Import issues from a JSON file specified at `<path>`.
|
656
|
+
| String
|
657
|
+
|
658
|
+
| `-i`, `--info`
|
659
|
+
| Reports existing labels and users in the database.
|
660
|
+
| Boolean
|
661
|
+
|
662
|
+
| `-L`, `--log-file`
|
663
|
+
| Name of the log file to output logs.
|
664
|
+
| String
|
665
|
+
|
666
|
+
| `-M`, `--mockup`
|
667
|
+
| Create mocked closed issues on Github for deleted tickets on Trac.
|
668
|
+
| Boolean
|
669
|
+
|
670
|
+
| `-o`, `--opened-only`
|
671
|
+
| Skips the import of closed tickets.
|
672
|
+
| Boolean
|
673
|
+
|
674
|
+
| `-r`, `--rev-map-file`
|
675
|
+
| Specify path of the RevMap file for migration.
|
676
|
+
| String
|
677
|
+
|
678
|
+
| `-S`, `--single-post`
|
679
|
+
| Put all Trac ticket comments in the first GitHub issue comment.
|
680
|
+
| Boolean
|
681
|
+
|
682
|
+
| `-s <ID>`, `--start-at <ID>`
|
683
|
+
| Start migration from ticket with number <ID>.
|
684
|
+
| String
|
685
|
+
|
686
|
+
| `-v`, `--verbose`
|
687
|
+
| Enable verbose mode.
|
688
|
+
| Boolean
|
689
|
+
|
690
|
+
|===
|
691
|
+
|
692
|
+
|
693
|
+
== Implementation details
|
694
|
+
|
695
|
+
=== Usage of GitHub Issue Import API
|
696
|
+
|
697
|
+
Tractive uses the GitHub
|
698
|
+
https://gist.github.com/jonmagic/5282384165e0f86ef105[Issue Import API]
|
699
|
+
to create Issues.
|
700
|
+
|
701
|
+
While this API is not available via GitHub's official API bindings (e.g.
|
702
|
+
Octokit), it offers several advantages over the normal Issue creation API:
|
703
|
+
|
704
|
+
* will not trigger abuse detection warnings and will not get blocked
|
705
|
+
* does not send out email notifications on issue changes
|
706
|
+
* does not increase your contribution count (especially if you attempt multiple import tries)
|
707
|
+
* faster than with the https://developer.github.com/v3/issues[GitHub v3 Issues API]
|
708
|
+
* allows setting the correct creation/closed date
|
709
|
+
* creates atomic changes without allowing users to interfere in the creation of
|
710
|
+
a single issue and its comments.
|
711
|
+
|
712
|
+
The caveat is that there is still no way of migrating an issue or comment
|
713
|
+
attributing to a third-party user account without using that user's GitHub
|
714
|
+
account, but this is likely a security concern that will not be addressed by
|
715
|
+
GitHub.
|
716
|
+
|
717
|
+
|
718
|
+
== Contributing
|
719
|
+
|
720
|
+
Bug reports and pull requests are welcome on GitHub at
|
721
|
+
https://github.com/ietf-ribose/tractive. This project is intended to be a safe,
|
722
|
+
welcoming space for collaboration, and contributors are expected to adhere to
|
723
|
+
the
|
724
|
+
https://github.com/ietf-ribose/tractive/blob/main/CODE_OF_CONDUCT.md[code of conduct].
|
725
|
+
|
726
|
+
|
727
|
+
== Code of conduct
|
728
|
+
|
729
|
+
Everyone interacting in the Tractive project's codebases, issue trackers, chat
|
730
|
+
rooms and mailing lists is expected to follow the
|
731
|
+
https://github.com/ietf-ribose/tractive/blob/main/CODE_OF_CONDUCT.md[code of conduct].
|
732
|
+
|
733
|
+
|
734
|
+
== License
|
735
|
+
|
736
|
+
Tractive and its supporting code are licensed under a
|
737
|
+
link:LICENSE.md[BSD-style licence].
|
738
|
+
|
739
|
+
Code inherited from `trac-hub` is under Matthias Vallentin's
|
740
|
+
link:LICENSE.md[BSD 3-Clause License].
|
741
|
+
|
742
|
+
Tractive is funded and developed by https://github.com/riboseinc[Ribose Inc.]
|