Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tag: v0.9
Fetching contributors…

Cannot retrieve contributors at this time

27 lines (19 sloc) 0.688 kB
from mercurial import hg, repo
from git_handler import GitHandler
class gitrepo(repo.repository):
def __init__(self, ui, path, create=True):
dest = hg.defaultdest(path)
if dest.endswith('.git'):
dest = dest[:-4]
# create the local hg repo on disk
dest_repo = hg.repository(ui, dest, create=True)
# fetch the initial git data
git = GitHandler(dest_repo, ui)
git.remote_add('origin', path)
# checkout the tip
node = git.remote_head('origin')
hg.update(dest_repo, node)
# exit to stop normal `hg clone` flow
raise SystemExit
instance = gitrepo
Jump to Line
Something went wrong with that request. Please try again.