index parser: fix refcounting in case of errors, refactor
due to incorrect refcounting, on a bad revlog it was failing with:
*** glibc detected *** /usr/bin/python: corrupted double-linked list: 0x
0816d318 ***
and a backtrace.
patch: pass linereader to binaryhunk.extract() instead of wrapped fp
It unifies input patch file access methods