Archive for August, 2011

30
Aug
11

using winmerge as difftool for mercurial


Described here:


[extensions]
; must uncomment this line
extdiff =

[extdiff]
; i'm using winmerge unicode version
cmd.winmerge = C:\Program Files (x86)\WinMerge\WinMergeU.exe
; it explains winmerge command line parameters here: http://winmerge.org/docs/manual/CommandLine.html
opts.winmerge = /r /e /x /u /wl

25
Aug
11

git import repo as subdir


Note: the merge will fail if you have no commits.


git remote add -f other_repo /path/to/other_repo
git merge -s ours --no-commit other_repo/master
git read-tree --prefix=path_where_other_repo_will_be/ other_repo/master -u

23
Aug
11

convert git repo to mercurial


Enable the convert extension by adding this in the .hgrc:


[extensions]
convert=

Then:


hg convert --datesort git_repo location_of_new_hg_repo

22
Aug
11

ruby convert between encodings


In Ruby 1.8.7, you can convert like this:


require "kconv"
# line, destination encoding, source encoding
Kconv.kconv(line,NKF::UTF8,NKF::UTF16)

20
Aug
11

work with git, push to mercurial repo

I would like to give credit for most of this information to Chris Adams’s article. Thank you Chris!

  1. Install git
  2. Install Mercurial
  3. Get hg-git from hg-git page
  4. NOTE: If you install TortoiseHG with Mercurial, you get dulwich for free. I don’t know if this applies for a regular Mercurial install as well ( I always get the package that contains TortoiseHG )
  5. Open the .hgrc file, and add this to it:

    
    [extensions]
    hggit=/path/to/extracted-hg-git/hggit
    bookmarks=
    [git]
    intree=1
    
    [bookmarks]
    track.current=True
    
  6. hg clone hgrepo
  7. Create a bookmark from the first revision of Mercurial’s default branch:
    
    hg book hg/default -r default
    
  8. Export it to git:
    hg gexport
  9. Create the git master branch:
    git branch --track master hg/default
  10. The git repository is a bare one, so, you should clone your repo elsewhere to work on it:
    git clone repo new_repo_location
  11. Work on new_repo_location, do commits, and then do a push so the changes get back to the Mercurial repo
  12. Go back to the original Mercurial repo, and import the git changes:
    hg gimport
  13. Push them via Mercurial

13
Aug
11

viewing log output on Android


If your app’s dying like crazy, or you want to see your own debugging output, and you want to see the logs/stacktrace, do this:

  1. make sure your AVD’s started
  2. open a command prompt and write adb shell
  3. write logcat

13
Aug
11

android set color from xml file


Here’s how you set a color, defined in your colors.xml, from code:


textView.setTextColor(getResources().getColor(R.color.red));




Blog Stats

  • 218,521 hits