Thursday, March 14, 2019

Useful GIT Commands

Git is a distributed version-control system for tracking changes in source code during software development. 
# delete local tag 'v2.0.1'
git tag -d v2.0.1

# delete remote tag 'v2.0.1' (eg, GitHub version too)
git push origin :refs/tags/v2.0.1

# alternative approach
git push --delete origin v2.0.1
git tag -d v2.0.1

Wednesday, March 6, 2019

"Invalid type String, expected Array for value" in RAML file in Anypoint Studio

While i was following the MuleSoft Developer Fundamental course I encoutered the "Invalid type String, expected Array for value" error during the import of RAML file from  Anypoint Platform to Anypoint Studio to generate API Flows. Due to this error I was not able to generate the API flow in Anypoint Studio.

This is due to some error in RAML file which was not flagged in the Anypoint Platform API Designer. Below is the fix that i used to make it work.


In your RAML, replace all usage of:
  1. examples: !include examples//AmericanFlightExample.raml
With this:
  1. examples:
  2. output: !include examples/AmericanFlightExample.raml

Reference:

Sunday, January 27, 2019

Migrate SVN repository to GIT

These are the steps that i followed during the SVN migration to GITHUB repository. svn2git is the utility that i used for this migration.


Prerequisites


 1. You should have git, git-svn and ruby installed. To verify execute below command

sudo apt-get install git-core git-svn ruby
  
2. Install svn2git using following command.

sudo gem install svn2git

Usage:
  • Checkout your svn repository to your local machine by executing below command. 
svn checkout 'repoName' --username 'userName'

  • Execute below command to extract the list of sub version committers. 
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt

  •  Run svn2-git utility (Pass the authors-transform.txt file)
svn2git 'repositoryName' --username 'username' --authors authors-transform.txt

 Note:  If the svn repository is a standard layout of (trunk, branches, tags) at the root level. So doesn't require any addional parameters while using svn2git command.  
  • Once the above command completes you shoud get a local git repository similar to your svn repository. 
  • Add remote origin using below command. 
git remote add origin git@github.com:Company/RepoName.git
  • Push master, all the other branches.
git push origin master
git push origin --all
  • Push Tags to remote git repository by execuing following command. 
git push origin --tags