Example #1
0
def gclone(ui, git_url, hg_repo_path=None):
    # determine new repo name
    if not hg_repo_path:
        hg_repo_path = hg.defaultdest(git_url)
        if hg_repo_path.endswith('.git'):
            hg_repo_path = hg_repo_path[:-4]
        hg_repo_path += '-hg'
    dest_repo = hg.repository(ui, hg_repo_path, create=True)

    # fetch the initial git data
    git = GitHandler(dest_repo, ui)
    git.remote_add('origin', git_url)
    git.fetch('origin')
    
    # checkout the tip
    node = git.remote_head('origin')
    hg.update(dest_repo, node)
Example #2
0
    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)
        git.fetch('origin')

        # checkout the tip
        node = git.remote_head('origin')
        hg.update(dest_repo, node)

        # exit to stop normal `hg clone` flow
        raise SystemExit
Example #3
0
 def pull(self, remote, heads=None, force=False):
     if isinstance(remote, gitrepo):
         git = GitHandler(self, self.ui)
         git.fetch(remote.path, heads)
     else: #pragma: no cover
         return super(hgrepo, self).pull(remote, heads, force)
Example #4
0
 def pull(self, remote, heads=None, force=False):
     if isinstance(remote, gitrepo):
         git = GitHandler(self, self.ui)
         return git.fetch(remote.path, heads)
     else:  #pragma: no cover
         return super(hgrepo, self).pull(remote, heads, force)
Example #5
0
def gfetch(ui, repo, remote_name='origin'):
    repo.ui.status(_("pulling from git url\n"))
    git = GitHandler(repo, ui)
    git.fetch(remote_name)