--- a/bitbucket/cmd.go Mon Jul 27 21:13:18 2020 -0500
+++ b/bitbucket/cmd.go Mon Jul 27 21:14:25 2020 -0500
@@ -9,6 +9,7 @@
Archive string `kong:"arg,name='archive',help='The zip file containing the archive'"`
Repository string `kong:"arg,name='repository',help='The repository name on bitbucket.'"`
UsersMapFile string `kong:"arg,name="users-map",help='A key=value file mapping emails to display names'"`
+ MaxIssues int `kong:"flag,name='max-issues',short='x',help='The maximum number of issues to import.', default='-1'"` func (c *Cmd) Run(g *globals.Globals) error {
@@ -28,5 +29,5 @@
- return youtrack.Import(g, project)
+ return youtrack.Import(g, project, c.MaxIssues) --- a/build-and-run Mon Jul 27 21:13:18 2020 -0500
+++ b/build-and-run Mon Jul 27 21:14:25 2020 -0500
@@ -1,8 +1,8 @@
echo -n "deleting project \"${1}\" ... "
curl -X DELETE -H "Authorization: Bearer ${YOUTRACK_TOKEN}" "${YOUTRACK_URL}rest/admin/project/${1}"
-./youtrack-import --project-id="${1}" --project-name="${2}" trac "${3}" "--import-users=${4}"
+time ./youtrack-import --project-id="${1}" --project-name="${2}" trac "${3}" "--import-users=${4}" -x 3000 --- a/trac/cmd.go Mon Jul 27 21:13:18 2020 -0500
+++ b/trac/cmd.go Mon Jul 27 21:14:25 2020 -0500
@@ -10,6 +10,7 @@
EnvPath string `kong:"arg,name='tracenv',help='The path to the trac environment'"`
ImportUsers string `kong:"flag,name='import-users',help='The json file of users to import',required='true',type='existingfile'"`
UnknownUser string `kong:"flag,name='unknown-user',help='The login name to use for unknown users',default='ghost'"`
+ MaxIssues int `kong:"flag,name='max-issues',short='x',help='The maximum number of issues to import.', default='-1'"` func (c *Cmd) Run(g *globals.Globals) error {
@@ -30,5 +31,5 @@
- return youtrack.Import(g, project)
+ return youtrack.Import(g, project, c.MaxIssues) --- a/youtrack/import.go Mon Jul 27 21:13:18 2020 -0500
+++ b/youtrack/import.go Mon Jul 27 21:14:25 2020 -0500
@@ -7,7 +7,7 @@
"keep.imfreedom.org/grim/youtrack-import/globals"
-func Import(g *globals.Globals, p *Project) error {
+func Import(g *globals.Globals, p *Project, maxIssues int) error { client, err := NewClient(g.URL, g.Token)
@@ -21,6 +21,12 @@
+ // now adjust the length of issues if the user has requested import a + // maximum number of issues. + p.Issues = p.Issues[:maxIssues] p.LeadLogin = g.ProjectLeadLogin