Mercurial > hg-git
diff git_handler.py @ 17:ace0f6ed65a1
setting up for upload-pack functionality
author | Scott Chacon <schacon@gmail.com> |
---|---|
date | Sun, 26 Apr 2009 17:56:16 -0700 |
parents | 58cd05129119 |
children | 2be9c0bd88af |
line wrap: on
line diff
--- a/git_handler.py Sun Apr 26 17:23:06 2009 -0700 +++ b/git_handler.py Sun Apr 26 17:56:16 2009 -0700 @@ -18,11 +18,12 @@ self.load_map() self.load_config() + # make the git data directory 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) + if not os.path.exists(git_hg_path): + 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') @@ -66,6 +67,12 @@ self.import_git_objects(remote_name) self.save_map() + def push(self, remote_name): + self.ui.status(_("pushing to : " + remote_name + "\n")) + self.export_git_objects() + self.upload_pack(remote_name) + self.save_map() + # TODO: make these actually save and recall def remote_add(self, remote_name, git_url): self._config['remote.' + remote_name + '.url'] = git_url @@ -79,6 +86,9 @@ if head == 'HEAD': return self._map[sha] return None + + def upload_pack(self, remote_name): + self.ui.status(_("upload pack\n")) def fetch_pack(self, remote_name): git_url = self.remote_name_to_url(remote_name)