Monthly Archives: December 2014

Subversion Branch and Trunk Sync – Hands On

Subversion has got concept of branches and trunk. Usually the accepted approach is to keep the trunk stable and do all unstable work on the branch. I am going to document how you can create a branch from a workspace using the trunk of a subversion repository. Further I will show how to pull changes done on the branch back into the trunk and vice-versa.

Please replace the localhost:8443 with your subversion URL, the /svn/cjpcs_repo/trunk with your trunk folder and the /svn/cjpc_repo/branches/temp/abhinav with your intended branch folder.

First we create a branch from a workspace checked out to trunk. In this snippet we are creating a shallow copy of the trunk into a branch.
svn copy https://localhost:8443/svn/cjpc_repo/trunk https://localhost:8443/svn/cjpc_repo/branches/temp/abhinav -m "Created a personal branch for abhinav"

In order to start using the branch we need to checkout the branch into a workspace. In this snippet are checking out the branch into the current folder.
svn checkout https://localhost:8443/svn/cjpc_repo/branches/temp/abhinav .

Now you can make some changes on the branch workspace and commit it. Now we need to merge the changes done on branch into the trunk. So go to the trunk workspace and execute the following command. The first command updates the trunk. The second command pulls in all the changes from the branch into the current workspace. If the merge causes some conflicts you need to resolve it manually.
svn update
svn merge https://localhost:8443/svn/cjpc_repo/branches/temp/abhinav

Now commit the merged changes into the trunk. The first command commits the merges done into the trunk and the second command basically confirms the merge.
svn commit -m "Merging changes from the branch"
svn log

That’s it. Your trunk is updated with the changes done on the branch. The same approach can be applied for updating the branch with all the changes on the trunk. The following short snippet summarizes the commands you should execute in your branch workspace to achieve a sync with trunk. If there are conflicts in the merge you need to resolve that manually.
svn update
svn merge https://localhost:8443/svn/cjpc_repo/trunk
svn commit -m "Merging changes from the trunk"

See hidden files in Mac OS Finder

I like to see all the files in the project folder where I am working. So it is inconvenient not being able to see “.gitignore” and “.git” inside the folder where I have git repository. On a brief lookup of the internet I found this article which proposes two approach of making hidden files visible in finder.

Approach #1: Using Terminal

To show hidden files
defaults write AppleShowAllFiles TRUE
killall Finder

To turn off showing of hidden files
defaults write AppleShowAllFiles TRUE
killall Finder

Approach #2: Using an App
Funter is a small app which allows the user to toggle the hidden file visibility on and off at the click of a button which is quite convenient.

What I used?
I preferred the terminal approach as I am fairly comfortable with it and I didn’t want to add a new application into my mac’s start-up and menu bar.

How to find Linux distribution and kernel version

In order find out what version of Linux you are running you can execute either of the following commands:

  • cat /etc/*-release
  • lsb_release -a
  • cat /proc/version
  • dmesg | head -1

To find out the kernel version of Linux you can execute either of the following commands:

  • uname -a
  • uname -mrs

Disclaimer: These commands worked for me on Debian Linux.

Update for Oracle Linux

The following commands gave accurate information about OS and release numbers on Oracle Linux.

rpm -qf /etc/redhat-release

cat /etc/ | head -1

Oracle Linux Server release 6.8