Total Pageviews

Disclaimer

This is a personal web page. The views expressed on this blog are mine and do not necessarily reflect the views of my current employer.

I am currently employed by Morgan Stanley.

January 27, 2012

How I Migrated SharpSnmpLib From Mercurial to Git

There are tons of articles on this topic. Here I just summarized what I have done.
 
Generate Local Git Repository via Hg-Git
 
The Mercurial repository of #SNMP is at d:\sharpsnmplib
 
I am on Windows 7 and using the latest TortoiseHg. In this case I have to roll back to TortoiseHg 2.0.5 (because Hg-Git does not support latest Hg) first.
 
  • TortoiseHg 2.0.5 does have Dulwich, so I don't need to install it right now.
  • So I can go to step 3 directly, and clone the Mercurial repository of Hg-Git from http://bitbucket.org/durin42/hg-git/ to d:\temp\hg-git
  • Then I modified d:\sharpsnmplib\.hg\hgrc to include the following lines,
[extensions]
hgext.bookmarks =
hggit = d:\temp\hg-git\hggit
  • You can now try to push to GitHub in d:\sharpsnmplib by executing "hg push git+ssh://git@github.com/schacon/hg-git.git".
Troubleshooting Issues
 
This push may fail due to an SSH error. In that case assuming you have set up Git following http://help.github.com/win-set-up-git/ , you may install TortoiseGit, and launch puttygen.exe from its installation folder to load your private key. Then you can save the key in PuTTY format (.ppk) and launch pageant.exe from TortoiseHg installation folder so as to add this new key. After that you can push again to see if everything works fine.
 
In my case it failed with an invalid parameter error which I cannot address. But the local Git repository is ready in d:\sharpsnmplib\.hg\git
 
Consolidate Local Git Repository
 
To be safe, I used TortoiseGit to create an empty Git repository at d:\temp\sharpsnmplib. Then I copy d:\sharpsnmplib\.hg\git to d:\temp\sharpsnmplib\.git.
 
Next I followed http://christoph.ruegg.name/blog/2011/7/30/cleaning-up-after-migrating-from-hg-to-git.html to perform the housekeeping at d:\temp\sharpsnmplib,
  • git fsck --full
  • git prune
  • git gc --aggressive
If you don't know how to find git command, you may read http://help.github.com/win-set-up-git/.
 
Upload to GitHub
 
Finally I went to GitHub to create a repository. It is time to upload everything to it,
Remaining Issues
 
If you use branching heavily, then you may experience more issues like me. Here are my fixes,
 
1. Unnamed Branches
Use TortoiseGit to show log on d:\temp\sharpsnmplib and I can see unnamed branches (the branch names seem to be removed during conversion). To rename them, we can simply create new branches in the log view, http://superuser.com/questions/382602/git-repository-migrated-from-mercurial-shows-unnamed-branches .
 
2. Messy Committers and Authors
I was not able to find a suitable way to clean up them without breaking the repository, so I decided to leave it as it was. This is bit of expected after Subversion to Mercurial to Git migration.

TritonMate: Migrated to GitHub

Due to the following reasons, I just converted the repository from Mercurial to Git and host it on GitHub,
  • Git enjoys the first class support in most IDE and OS.
  • GitHub is more popular than Google Code or CodePlex, and it has code search.
  • TortoiseGit is much more convenient to use now.
  • MonoDevelop does not have Mercurial support.
  • ...
From now on, new change sets will only appear on the GitHub page,
 
 
Please bookmark this link or watch this repository :)

January 25, 2012

TritonMate Words: Sad News on Linux Support

Just started to dig on Linux/Mono side, as the changes we made on the 8.0 way are so huge. In a few minutes, a serious problem was found,
 
 
Not sure how long it will take to have this issue resolved, but it makes our Linux support bit of tough. However, more issues may be ahead, as I am not sure whether SharpDevelop text editor works fine on Mono. In the coming days I will test more on Mono side and report more issues to Mono guys.
 
Stay tuned.

January 24, 2012

TritonMate Words: Syntax Highlighting for SMI/MIB

smi_syntax_highlighting by lextm
smi_syntax_highlighting, a photo by lextm on Flickr.

Finally syntax highlighting is added. Currently we use SharpDevelop's text editor control, and its syntax highlighting engine (line number as well).

Since SharpDevelop does not have an SMI/MIB syntax file, I followed the standard approach to port smi-mib.xml from jEdit. Yes, without doing this you never know #D guys learned from jEdit :)

Here I share the syntax highlighting file, http://code.google.com/p/sharpsnmplib/source/browse/Compiler/smi.xshd so that you may reuse it in your applications.

January 22, 2012

TritonMate Words: Compiler Update So Far

Here comes some good news on the ANTLR based compiler,
  • The port from ANTLR v2 to v3 is complete, and now we have the first open source SMI grammar file for ANTLR 3, http://code.google.com/p/sharpsnmplib/source/browse/SharpSnmpLib/Mib/Smi.g (smi_no_action.g is the Java version without actions).
  • I contacted Nigel Sheridan-Smith, and he confirmed that his previous work is open source under BSD license, and he also accepts LGPL.
  • My modifications of this grammar then is also released under BSD license and LGPL.
  • As we cannot contact Vivek Gupta (no contact method can be found), we can only assume he published the original ASN.1 grammar in public domain (since he published it on ANTLR sample section, where most grammars are either under BSD or in public domain).
Then we can see what are the features implemented right now in this new compiler,
  • MSBuild compliant error and warning messages.
  • More accurate parsing on macros and other complex SMI entities.
  • Automatic ANTLR grammar to C# code generation at compile time.
Now the challenge is how to keep improving it and make it a better tool for MIB authors. Of course, the code base is still messy, and I am going to do more cleanup in the coming weeks.
 
Happy Chinese New Year :)

January 07, 2012

ASP.NET/IIS MVP This Year

I've just received the MVP award from Microsoft under ASP.NET/IIS category for 2012. Though losing my 7-day-long brand new Android phone yesterday makes my life bit of tough, I still consider that it is generally brighter this year for me.
 
Not yet get my gift box, which FedEx says will arrive next Monday. But I wish that I could do more than last year for the whole IIS/.NET community.
 

January 03, 2012

Windows XP Everywhere

(CSDN Jan 02, 2011)
 
We all know that Windows XP is a great product. It is so great that sometimes you don't know its existence.
 
 

出席MY+上海活动

(CSDN Oct 20, 2010)
 
上周六闲来无事,就去魅族在上海的MY+活动打发一下时间,顺便沿着北外滩的一小段走走,了解一下到底苏州河以北是个什么样子。
 
自己没有带相机,也不想让M8那么早没电,所以就没有照片了。但是为了做到有图有真相,就把碰巧魅族工作人员拍下的准特写转贴一下,
 
 
是的,真的就是我。能在现场那么多人里面挑中M8 Theme Builder的作者,足见这位摄影师的运气。
 
原帖见http://bbs.meizu.com/thread-2160200-1-1.html
 
P.S., 看了看现场少男少女们青春无敌的架势,没敢等到晚饭和抽奖的热情大爆发时刻。反正自己从来也没被抽到大奖,就提前溜了。:)