refactor gitpkg and register hgpkg in core package