Project

General

Profile

Simple .NET app to migrate issues between Redmine hosts

Added by Aleksey Oriekhov over 5 years ago

Hi all,

I've created a simple .NET console application to migrate issues between different Redmine hosts.
It can be useful if you don't have access to database and/or not able to export your data in raw format.

Actually, Redmine can export part of the data, but it can't export journal notes, which are often contain important information about the issue.
So, I've decided to create own script which will copy journal comments as well. Note, that only text of journal comment is copied, all other information omitted.

See the code below. To compile it, you will need to use Redmine .NET API library
Also, the next links could be useful:
http://www.redmine.org/projects/redmine/wiki/Rest_api_with_csharp
https://code.google.com/p/redmine-net-api/w/list
http://www.redmine.org/projects/redmine/wiki/Rest_Issues

Code:

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Redmine.Net.Api;
using Redmine.Net.Api.Types;

namespace RedmineIssuesMigrationTool
{
    class Program
    {
        static void Main(string[] args)
        {
            const string sourceHost = "http://localhost:8080/redmine";
            const string sourceApiKey = "your_hash_here";
            //const string sourceProject = "your-project-name";

            const string targetHost = "https://www.hostedredmine.com";
            const string targetApiKey = "your_target_hash_here";
            // project id on target host, can be received by calling manager.GetTotalObjectList<Project>(listParams);
            const int targetProjectId = 9999; 

            var sourceManager = new RedmineManager(sourceHost, sourceApiKey);
            var targetManager = new RedmineManager(targetHost, targetApiKey);

            var listParams = new NameValueCollection
            {
                //{ "project_id", sourceProject},
                { "status_id", "open" } // open, closed or *
            };
            var issueParams = new NameValueCollection
            {
                { "include", "journals"}
            };

            // warning. this code is not fast, especially if you have lots of issues!
            IList<Issue> issuesList = sourceManager.GetTotalObjectList<Issue>(listParams);

            foreach (var issue in issuesList)
            {
                Console.WriteLine("#{0}: {1}", issue.Id, issue.Subject);

                // get additional info about issue
                var issueDetails = sourceManager.GetObject<Issue>(issue.Id.ToString(CultureInfo.InvariantCulture), issueParams);

                //Create a issue on target host
                var newIssue = new Issue();
                newIssue.Project = new IdentifiableName() {Id = targetProjectId};
                newIssue.Tracker = issueDetails.Tracker; // valid only if basic trackers used, e.g. bug, feature, support... for custom you have to map each tracker
                newIssue.Status = issueDetails.Status; // same as above, if no custom statuses, it's OK

                //newIssue.Priority = new IdentifiableName() { Id = issueDetails.Priority.Id };
                newIssue.Priority = issueDetails.Priority; // same as above

                newIssue.Subject = issueDetails.Subject;
                newIssue.Description = issueDetails.Description;

                //newIssue.Category = issueDetails.Category; // to use categories you have to implement mapping: source category -> target category
                //newIssue.AssignedTo = new IdentifiableName() { Id = 999 };

                var createdIssue = targetManager.CreateObject(newIssue);

                // not sure if journal is already sorted or not, sort it anyway
                var sortedList = issueDetails.Journals.OrderBy(journal => journal.CreatedOn);
                // migrate journal notes
                foreach (var journal in sortedList)
                {
                    // skip empty comments
                    if (!string.IsNullOrEmpty(journal.Notes))
                    {
                        Console.WriteLine("@{0}: {1}", journal.CreatedOn, journal.Notes);

                        createdIssue.Notes = journal.Notes;
                        targetManager.UpdateObject(createdIssue.Id.ToString(CultureInfo.InvariantCulture), createdIssue);
                    }
                }
            }
        }
    }
}


Replies (7)

RE: Simple .NET app to migrate issues between Redmine hosts - Added by Alex ferguson over 1 year ago

In reality, Redmine can trade some portion of the information, yet it can't send out diary notes, which regularly contain critical data about the issue. Can Someone Do My Essay In this way, I've chosen to make possess content which will duplicate diary remarks also. Note, that exclusive content of diary remark is replicated,

RE: Simple .NET app to migrate issues between Redmine hosts - Added by Arabella Alice 8 months ago

Definitely, Redmine facilitating administration encourages you a considerable measure in your ventures and [url=http://www.buyessaytoday.com/]purchase essay online[/url] organizations. It was checked on in a blog I had perused previously.

RE: Simple .NET app to migrate issues between Redmine hosts - Added by Doris J. Titsworth Doris J. Titsworth 8 months ago

It was an awesome script which I noticed here today. I have tried it before for my rushmyessay.com review blogs. Generally we have taken the essay blog experts help in creating new alternative toolkit and now we are using that toolkit only for our company project works.

RE: Simple .NET app to migrate issues between Redmine hosts - Added by Jasmine Freeman 8 months ago

As a general rule, Redmine can exchange some segment of the data, yet it can't convey journal notes, which routinely contain basic information about the issue. Would someone be able to Law Essay Help in UK along these lines, I've made have content which will copy journal comments too? Note, that select substance of journal comment is duplicated,

RE: Simple .NET app to migrate issues between Redmine hosts - Added by Carolina Emory 6 months ago

Designed for the console and show screen, a support application is driven by console and framework occasions created by system associations and items. manufactured home parks

RE: Simple .NET app to migrate issues between Redmine hosts - Added by abbas abbas 3 months ago

Hari itu kami mengobrol. Mereka mulai berbicara tentaling 6
http://www.besibaja.id/agen-astm-a283-c.html agen astm a283 c
http://www.besibaja.id/agen-pipa-boiler.html agen pipa boiler
http://www.besibaja.id/agen-plat-abrex-400.html agen plat abrex 400
http://www.besibaja.id/agen-plat-asme516-grade70.html agen plat asme516 grade70
http://www.besibaja.id/agen-plat-astm-a285-c.html agen plat astm a285 c
http://www.besibaja.id/agen-plat-astm516-70.html agen plat astm516 70
http://www.besibaja.id/agen-plat-boiler.html agen plat boiler
http://www.besibaja.id/agen-plat-hardox.html agen plat hardox
http://www.besibaja.id/agen-plat-hb-400.html agen plat hb 400
http://www.besibaja.id/agen-plat-high-strenght.html agen plat high strenght
http://www.besibaja.id/agen-plat-high-tensile-sm490-yb.html agen plat high tensile sm490 yb
http://www.besibaja.id/agen-plat-high-tensile-sm490ya.html agen plat high tensile sm490ya
http://www.besibaja.id/agen-plat-kapal.html agen plat kapal
http://www.besibaja.id/agen-plat-stainless-ss304.html agen plat stainless ss304
http://www.besibaja.id/agen-plat-stainless-ss310.html agen plat stainless ss310
http://www.besibaja.id/agen-plat-stainless-ss316.html agen plat stainless ss316
http://www.besibaja.id/agen-plat-sumihard.html agen plat sumihard
http://www.besibaja.id/agen-round-bar-besi-aisi-440s45c.html agen round bar besi aisi 440s45c
http://www.besibaja.id/agen-round-bar-scm440.html agen round bar scm440
http://www.besibaja.id/agen-steel-rail.html agen steel rail
http://www.besibaja.id/agen-steel-sheet-pile.html agen steel sheet pile
http://www.besibaja.id/distributor-astm-a283-c.html distributor astm a283 c
http://www.besibaja.id/distributor-pipa-boiler.html distributor pipa boiler
http://www.besibaja.id/distributor-plat-abrex-400.html distributor plat abrex 400
http://www.besibaja.id/distributor-plat-asme516-grade70.html distributor plat asme516 grade70
http://www.besibaja.id/distributor-plat-astm-a285-c.html distributor plat astm a285 c
http://www.besibaja.id/distributor-plat-astm516-70.html distributor plat astm516 70
http://www.besibaja.id/distributor-plat-boiler.html distributor plat boiler
http://www.besibaja.id/distributor-plat-hb-400.html distributor plat hb 400
http://www.besibaja.id/distributor-plat-high-strenght.html distributor plat high strenght
http://www.besibaja.id/distributor-plat-high-tensile-sm490-yb.html distributor plat high tensile sm490 yb
http://www.besibaja.id/distributor-plat-high-tensile-sm490ya.html distributor plat high tensile sm490ya
http://www.besibaja.id/distributor-plat-kapal.html distributor plat kapal
http://www.besibaja.id/distributor-plat-stainless-ss304.html distributor plat stainless ss304
http://www.besibaja.id/distributor-plat-stainless-ss310.html distributor plat stainless ss310
http://www.besibaja.id/distributor-plat-stainless-ss316.html distributor plat stainless ss316
http://www.besibaja.id/distributor-plat-sumihard.html distributor plat sumihard
http://www.besibaja.id/distributor-round-bar-besi-aisi-440s45c.html distributor round bar besi aisi 440s45c
http://www.besibaja.id/distributor-round-bar-scm440.html distributor round bar scm440
http://www.besibaja.id/distributor-steel-rail.html distributor steel rail
http://www.besibaja.id/distributor-steel-sheet-pile.html distributor steel sheet pile
http://www.besibaja.id/jual-astm-a283-c.html jual astm a283 c
http://www.besibaja.id/jual-baja-h-beam.html jual baja h beam
http://www.besibaja.id/jual-pipa-boiler.html jual pipa boiler
http://www.besibaja.id/jual-plat-abrex-400.html jual plat abrex 400
http://www.besibaja.id/jual-plat-asme516-grade70.html jual plat asme516 grade70
http://www.besibaja.id/jual-plat-astm-a285-c.html jual plat astm a285 c
http://www.besibaja.id/jual-plat-astm516-70.html jual plat astm516 70
http://www.besibaja.id/jual-plat-boiler.html jual plat boiler
http://www.besibaja.id/jual-plat-hardox.html jual plat hardox
http://www.besibaja.id/jual-plat-hb-400.html jual plat hb 400
http://www.besibaja.id/jual-plat-high-strenght.html jual plat high strenght
http://www.besibaja.id/jual-plat-high-tensile-sm490-yb.html jual plat high tensile sm490 yb
http://www.besibaja.id/jual-plat-high-tensile-sm490ya.html jual plat high tensile sm490ya
http://www.besibaja.id/jual-plat-kapal.html jual plat kapal
http://www.besibaja.id/jual-plat-stainless-ss304.html jual plat stainless ss304
http://www.besibaja.id/jual-plat-stainless-ss310.html jual plat stainless ss310
http://www.besibaja.id/jual-plat-stainless-ss316.html jual plat stainless ss316
http://www.besibaja.id/jual-plat-sumihard.html jual plat sumihard
http://www.besibaja.id/jual-round-bar-besi-aisi-440s45c.html jual round bar besi aisi 440s45c
http://www.besibaja.id/jual-round-bar-scm440.html jual round bar scm440
http://www.besibaja.id/jual-steel-rail.html jual steel rail
http://www.besibaja.id/jual-steel-sheet-pile.html jual steel sheet pile
http://www.besibaja.id/pabrik-astm-a283-c.html pabrik astm a283 c
http://www.besibaja.id/pabrik-pipa-boiler.html pabrik pipa boiler
http://www.besibaja.id/pabrik-plat-abrex-400.html pabrik plat abrex 400
http://www.besibaja.id/pabrik-plat-asme516-grade70.html pabrik plat asme516 grade70
http://www.besibaja.id/pabrik-plat-astm516-70.html pabrik plat astm516 70
http://www.besibaja.id/pabrik-plat-boiler.html pabrik plat boiler
http://www.besibaja.id/pabrik-plat-hb-400.html pabrik plat hb 400
http://www.besibaja.id/pabrik-plat-high-tensile-sm490-yb.html pabrik plat high tensile sm490 yb
http://www.besibaja.id/pabrik-plat-high-tensile-sm490ya.html pabrik plat high tensile sm490ya
http://www.besibaja.id/pabrik-plat-kapal.html pabrik plat kapal
http://www.besibaja.id/pabrik-plat-stainless-ss304.html pabrik plat stainless ss304
http://www.besibaja.id/pabrik-plat-stainless-ss310.html pabrik plat stainless ss310
http://www.besibaja.id/pabrik-round-bar-besi-aisi-440s45c.html pabrik round bar besi aisi 440s45c
http://www.besibaja.id/pabrik-round-bar-scm440.html pabrik round bar scm440
http://www.besibaja.id/pabrik-steel-rail.html pabrik steel rail
http://www.besibaja.id/pabrik-steel-sheet-pile.html pabrik steel sheet pile
http://www.besibaja.id/pusat-astm-a283-c.html pusat astm a283 c
http://www.besibaja.id/pusat-pipa-boiler.html pusat pipa boiler
http://www.besibaja.id/pusat-plat-abrex-400.html pusat plat abrex 400
http://www.besibaja.id/pusat-plat-asme516-grade70.html pusat plat asme516 grade70
http://www.besibaja.id/pusat-plat-astm-a285-c.html pusat plat astm a285 c
http://www.besibaja.id/pusat-plat-astm516-70.html pusat plat astm516 70
http://www.besibaja.id/pusat-plat-boiler.html pusat plat boiler
http://www.besibaja.id/pusat-plat-hardox.html pusat plat hardox
http://www.besibaja.id/pusat-plat-hb-400.html pusat plat hb 400
http://www.besibaja.id/pusat-plat-high-strenght.html pusat plat high strenght
http://www.besibaja.id/pusat-plat-high-tensile-sm490-yb.html pusat plat high tensile sm490 yb
http://www.besibaja.id/pusat-plat-high-tensile-sm490ya.html pusat plat high tensile sm490ya
http://www.besibaja.id/pusat-plat-kapal.html pusat plat kapal
http://www.besibaja.id/pusat-plat-stainless-ss304.html pusat plat stainless ss304
http://www.besibaja.id/pusat-plat-stainless-ss310.html pusat plat stainless ss310
http://www.besibaja.id/pusat-plat-stainless-ss316.html pusat plat stainless ss316
http://www.besibaja.id/pusat-plat-sumihard.html pusat plat sumihard
http://www.besibaja.id/pusat-round-bar-besi-aisi-440s45c.html pusat round bar besi aisi 440s45c
http://www.besibaja.id/pusat-round-bar-scm440.html pusat round bar scm440
http://www.besibaja.id/pusat-steel-rail.html pusat steel rail
http://www.besibaja.id/pusat-steel-sheet-pile.html pusat steel sheet pile
http://www.besibaja.id/stockis-plat-hardox.html stockis plat hardox
http://www.besibaja.id/stockist-plat-astm-a285-c.html stockist plat astm a285 c
http://www.besibaja.id/stockist-plat-high-strenght.html stockist plat high strenght
http://www.besibaja.id/stockist-plat-stainless-ss316.html stockist plat stainless ss316
http://www.besibaja.id/stockist-plat-sumihard.html stockist plat sumihard
http://www.besibaja.id/supplier-plat-hardox.html supplier plat hardox
http://www.besibaja.id/plat-stainless-ss201.html plat stainless ss201
http://www.besibaja.id/plat-sphc-po.html plat sphc po
http://www.besibaja.id/plat-putih-spcc-sd.html plat putih spcc sd
http://www.besibaja.id/plat-hitam-ss400.html plat hitam ss400
http://www.besibaja.id/plat-hitam-sphc.html plat hitam sphc
http://www.besibaja.id/plat-corten.html plat corten
http://www.besibaja.id/plat-astm-a36.html plat astm a36
http://www.besibaja.id/plat-alumunium.html plat alumunium
http://www.besibaja.id/plat-abrex-500.html plat abrex 500
http://www.besibaja.id/plat-abrex-450.html plat abrex 450
http://www.besibaja.id/plain-bar.html plain bar
http://www.besibaja.id/pipa-sch80.html pipa sch80
http://www.besibaja.id/pipa-sch40.html pipa sch40
http://www.besibaja.id/pipa-sch160.html pipa sch160
http://www.besibaja.id/pipa-sch120.html pipa sch120
http://www.besibaja.id/pipa-sch10.html pipa sch10
http://www.besibaja.id/pipa-medium-galvanis.html pipa medium galvanis
http://www.besibaja.id/perforated-plate.html perforated plate
http://www.besibaja.id/grating-size-galvanis.html grating size galvanis
http://www.besibaja.id/expanded-metal.html expanded metal
http://www.besibaja.id/deformed-bar.html deformed bar
http://www.besibaja.id/besi-wiremesh.html besi wiremesh
http://www.besibaja.id/besi-unp.html besi unp
http://www.besibaja.id/besi-cnp.html besi cnp
http://www.besibaja.id/besi-baja-wfbeam.html besi baja wfbeam
http://www.besibaja.id/baja-h-beam.html baja h beam

    (1-7/7)