Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 27 lines (19 sloc) 0.688 kB
de4597d @defunkt add support for `hg clone git://github.com/defunkt/facebox.git`
defunkt authored
1 from mercurial import hg, repo
2 from git_handler import GitHandler
3
4 class gitrepo(repo.repository):
ee68282 @defunkt don't need to fake out hg with `capabilities` anymore
defunkt authored
5 def __init__(self, ui, path, create=True):
de4597d @defunkt add support for `hg clone git://github.com/defunkt/facebox.git`
defunkt authored
6 dest = hg.defaultdest(path)
7
8 if dest.endswith('.git'):
9 dest = dest[:-4]
10
11 # create the local hg repo on disk
12 dest_repo = hg.repository(ui, dest, create=True)
13
14 # fetch the initial git data
15 git = GitHandler(dest_repo, ui)
16 git.remote_add('origin', path)
17 git.fetch('origin')
18
19 # checkout the tip
20 node = git.remote_head('origin')
21 hg.update(dest_repo, node)
22
ee68282 @defunkt don't need to fake out hg with `capabilities` anymore
defunkt authored
23 # exit to stop normal `hg clone` flow
de4597d @defunkt add support for `hg clone git://github.com/defunkt/facebox.git`
defunkt authored
24 raise SystemExit
25
26 instance = gitrepo
Something went wrong with that request. Please try again.