Mercurial > hg > hg-git
changeset 16:58cd05129119
moved init into git_handler
author | Scott Chacon <schacon@gmail.com> |
---|---|
date | Sun, 26 Apr 2009 17:23:06 -0700 (2009-04-27) |
parents | 5a98480a0806 |
children | ace0f6ed65a1 |
files | TODO.txt __init__.py git_handler.py |
diffstat | 3 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/TODO.txt +++ b/TODO.txt @@ -2,6 +2,7 @@ ========== * remote management +* submodules? PUSH ========== @@ -26,6 +27,6 @@ FETCH =========== +* add removed files to filechanged and raise IOError * gfetch command * only try to import non-mapped commits -* strip or close branches that have been abandoned (?)
--- a/__init__.py +++ b/__init__.py @@ -27,7 +27,7 @@ from git_handler import GitHandler def gclone(ui, git_url, hg_repo_path=None): - ## TODO : add git_url as the default remote path + # determine new repo name if not hg_repo_path: hg_repo_path = hg.defaultdest(git_url) if hg_repo_path.endswith('.git'): @@ -35,11 +35,6 @@ hg_repo_path += '-hg' dest_repo = hg.repository(ui, hg_repo_path, create=True) - # make the git data directory - git_hg_path = os.path.join(hg_repo_path, '.hg', 'git') - os.mkdir(git_hg_path) - dulwich.repo.Repo.init_bare(git_hg_path) - # fetch the initial git data git = GitHandler(dest_repo, ui) git.remote_add('origin', git_url) @@ -50,6 +45,7 @@ hg.update(dest_repo, node) def gpush(ui, repo, remote_name): + # determine new repo name dest_repo.ui.status(_("pushing to git url\n")) def gpull(ui, repo):
--- a/git_handler.py +++ b/git_handler.py @@ -13,10 +13,17 @@ def __init__(self, dest_repo, ui): self.repo = dest_repo self.ui = ui + self.init_if_missing() self.load_git() self.load_map() self.load_config() + def init_if_missing(self): + # make the git data directory + git_hg_path = os.path.join(self.repo.path, 'git') + os.mkdir(git_hg_path) + dulwich.repo.Repo.init_bare(git_hg_path) + def load_git(self): git_dir = os.path.join(self.repo.path, 'git') self.git = Repo(git_dir)