Category Archives: Programming

From Assembla to GITHub – Phase 2: Migrate issues, comments and milestone

In my previous blog From Assembla to GITHub – Phase 1: Migrate your SVN repository to GIT I explained how to migrate your SVN repository to GIT and commit it to GITHub.

In this blog I will give some information on how to migrate Assembla issues into your GITHub repository, without losing any data.

Prerequisite

A PHP Web server to run the script

Chapter 1 – Export data from Assembla

From your Assembla console, Tickets->Settings->Export & Import and Export your tickets, this will generate a bak file (they say it is a JSON, but basically is text file with some JSON structure)

Assembla export

Chapter 2 – Import bak file into your GITHub repository

Here comes the fun… There is no easy way to import this file in GITHub, but they have very powerful REST services.

So, I decided to create a PHP script that parses the export file from Assembla and import to GITHub using their services. GITHub has no official API for PHP, but there are several GITHub repositories that are creating them.

I decided to use github-php-client, that, IMHO, has a great structure and flexibility. Unfortunately, these APIs are not fully compliant with the version 3 of GITHub services.

No fear! Is it an open source project? OK, let’s collaborate…

I created a fork of that project and I completed the API fixing the missing pieces for my scope (currently most of my changes have been included into the master, otherwise you can use my fork).

Then a simple PHP script will do the dirty job… The code is shared as open source here.

github import

After few minutes all the issues, comments and milestones were imported into my new GITHub repository!

Note Before starting the import of the file I suggest to test the export file in a dummy project, only after this test I would suggest to try on your official GIT repository. I have no responsibility on the use of this script.

From Assembla to GITHub – Phase 1: Migrate your SVN repository to GIT

I recently migrated my Assembla abap2xlsx to GITHub ( #abap2xlsx is relocating… Welcome to GITHub ) and I would like to share a quick “how to” just in case you want to migrate also your SVN repository to a GIT repository maintaining all the history.

Prerequisite

  • GIT installed on your machine, if you’re using GITHub you can install their Client
  • Having an SVN repository to migrate 

Let’s start our journey

Preface

Unfortunately, I switched to a Windows PC right now, so most of the screen shots and commands are referred to a windows machine, I’ll try to give you the same details also for Mac o Unix/Linux.

Chapter 1 – Prepare for migration

The first step is to prepare everything in order to have a smooth migration, in this case we need to create a file with the list of all the contributors of the SVN project, this file will be used in the next step to match users in repository history.

Using your console/shell move into the root of your SVN project

If you’re not in a windows machine

svn log -q | awk -F ‘|’ ‘/^r/ {sub(“^ “, “”, $2); sub(” $”, “”, $2); print $2″ = “$2” <“$2″>”}’ | sort -u > USERS.txt

On windows you have to install sed – the stream editor, simple copy sed.exe in the current folder (I’ll make this step simple, you can also add sed in your PATH) and then execute

svn log –quiet –xml | sed -n -e “s/<\/\?author>//g” -e “/[<>]/!p” | sort | sed “$!N; /^\(.*\)\n\1$/!P; D” > USERS.txt

The file is the list of all contributors that had made at least a commit to the repository. We need now to edit this file in order to make it like the snipped below, please pay attention to the charset otherwise the next steps will fail (never trust Notepad)

Alessandro Iannacci = Alessandro Iannacci <aiannacci@xxxxx.it>
gregor.wolf = Gregor Wolf <gregor.wolf@xxxxx.com>
IvanFemia = Ivan Femia <ivan.femia@xxxxxx.com>
JOACHIM.WRBA = Ivan Femia <ivan.femia@xxxxxx.com>
Ludek.Vondruska = Ludek Vondruska <Ludek.Vondruska@xxxxxx.cz>
p491969 = Ivan Femia <ivan.femia@xxxxx.com>
stefan_schmoecker = Stefan Schmöcker <schmoecker@xxxxxx.de>
Tomek Mackowski = Tomek Mackowski <tmackowski@xxxxx.com>
turnheim = Rene Turnheim <rturnheim@xxxxxx.com>
www-data = Ivan Femia <ivan.femia@xxxxxx.com>

Chapter 2 – Convert SVN repository

GITHubOpen your GIT shell and start the conversion…

Really easy? No this command depends on your SVN structure, so it depends on the TRUNK, BRANCHES, TAGS folders.

From GIT console move on a directory that you want to use a working dir and then execute the following command:

git svn clone [SVN repository URL] -A USERS.txt –stdlayout ~/temp

on a Windows machine I suggest to use /temp instead of ~/temp

This command it’s great  if you have a standard SVN layout, with all the three SVN folders; in my case, for example, I had only the trunk as a root so I executed

git svn clone [SVN repository URL] -A USERS.txt –trunk=/trunk /temp

For more information on git svn command please refer to the official documentation

Chapter 3 – Convert svn:ignore to .gitignore

From the GIT console execute this simple steps

cd temp
git svn show-ignore > .gitignore
git add .gitignore
git commit -m ‘Convert svn:ignore properties to .gitignore.’

It will convert the SVN ignore properties in the GIT ignore and add it to the commit.

Chapter 4 – Create the bare repository

Now we need to create our bare repository (.git folder) that will be imported in our Code Repository (e.g. GITHub)

git init –bare ~/your_project_name.git
cd ~/your_project_name.git
git symbolic-ref HEAD refs/heads/trunk

push the content into this bare repository

cd ~/temp
git remote add bare ~/your_project_name.git
git config remote.bare.push ‘refs/remotes/*:refs/heads/*’
git push bare

and link the trunk as master of the git bare

cd ~/new-bare.git
git branch -m trunk master

Chapter 5 – Gran finale: import into your Code Repository

You are now ready to import the .git bare folder into you git repository (in this case GITHub). Make sure that you have created a repository on GITHub with the same name of your bare folder.

cd your_project_name.git
git push –mirror https://github.com/your_user_name/your_project_name.git

and delete temporary folder

cd ..
rm -rf your_project_name.git

Epilogue – Enjoy

Enjoy GITHub!

In the next blog I will describe how to import issues, comments and milestone from Assembla to GITHub.

#abap2xlsx is relocating… Welcome to GITHub

It was June 2010 when I published the first release of abap2xlsx.

Thanks to this community, the project grew up quickly and acquired a lot of popularity…

I always loved open source approach, but in SAP this was not so easy to achieve. ABAP is a proprietary language and it had always some limitation in code sharing, but fortunately Code Exchange was born and the community found the pleasure of collaborating together in a project.

This was a first step to the real idea of open source, because Code Exchange was bounded to a very “sophisticated” TOU (Terms of Use), that obliged you to publish your code only under the Code Exchange Licence and on SAP Code Exchange Repository.

Just in time for the SAPTechEd Bangalore, the New Unified Developer Licence was released (read this blog Announcing the unified SAP Developer License by Juergen Schmerder and watch SAP Live Interview with Abesh BhattacharjeeArshit K and Marek Kowalkiewicz) and it gives you the freedom to choose your licence and share YOUR code using whatever channel you prefer 

What a great opportunity… GITHub I’m coming…

So today I decided to migrate abap2xlsx from Assembla to GITHub… I hope that this decision will give more visibility to the project and also simplify the collaboration between us in order to easily contribute.

Currently all the revisions’ history and issues (unfortunately with my username) have been migrated.

Unfortunately, Assembla doesn’t offer an easy way to export discussions, so I’m considering to collect the best discussions in the GITHub wiki. It will be very long work  (looking for volunteers).

In order to better manage discussions, I decided to use Code Exchange discussion board as the official channel for help requests, suggestions and so on…

More information on how to collaborate on the project will come soon… Stay tuned!

So what is missing? The new address 

It is so easy, it is always the same www.plinky.it/abap/abap2xlsx.php

This is why I like openUI5!

Last week at SAP TechEd Bangalore, SAP made a great step forward for the embracement of the Open Source development: OPENUI5 was released; Andreas Kunz wrote a very detailed blog What is OpenUI5 / SAPUI5 ? some days ago.

So I decided to use these libraries in order to create an application that could show the power of OPENUI5 as an Open Source framework for enterprise-ready web applications. In my case I decided to create a very simple Phone Book that consumes data form a Google Drive Form.

Continue reading This is why I like openUI5!

Being an SAP developer nowadays

Over the past few years we have experienced an innovation era in SAP. Mobile, Cloud and In-Memory are now the three foundations of enterprise computing and they are bringing a new life into the possibility to enrich and improve enterprise business.

Most of the people are talking about this innovation as a great step forward for the transformation of the “old style” SAP to a new one close to the current need of performing business quicker, anywhere and anytime, and they encourage customers to move into the innovation.

Continue reading Being an SAP developer nowadays