Mercurial > hg > hg-git
changeset 42:fcfb4db848e1
added hack for pushing first branch
author | Scott Chacon <schacon@gmail.com> |
---|---|
date | Tue, 28 Apr 2009 17:28:04 -0700 |
parents | 12d4f99c0702 |
children | e965895856e9 9f3f79a209d6 c79741c05fd8 |
files | TODO.txt git_handler.py |
diffstat | 2 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/TODO.txt +++ b/TODO.txt @@ -7,6 +7,7 @@ * bookmarks / tip / named branches - mapping policy to Git branches - tracking branches? * submodules? +* .gitignore, etc - try to convert? PUSH ========== @@ -30,7 +31,6 @@ MILESTONES ============= - * Hg<->Git<->Hg - create a repo in Hg - push to a Git server
--- a/git_handler.py +++ b/git_handler.py @@ -256,7 +256,9 @@ # sort by tree depth, so we write the deepest trees first dirs = trees.keys() dirs.sort(lambda a, b: len(b.split('/'))-len(a.split('/'))) - + dirs.remove('/') + dirs.append('/') + # write all the trees tree_sha = None tree_shas = {} @@ -289,15 +291,21 @@ except: raise - # TODO : for now, we'll just push all heads + # TODO : for now, we'll just push all heads that match remote heads # * we should have specified push, tracking branches and --all # takes a dict of refs:shas from the server and returns what should be # pushed up def get_changed_refs(self, refs): keys = refs.keys() - if not keys: + + changed = [] + if not keys: return None - changed = [] + + # TODO : this is a huge hack + if keys[0] == 'capabilities^{}': # nothing on the server yet - first push + changed.append(("0"*40, self.git.ref('master'), 'refs/heads/master')) + for ref_name in keys: parts = ref_name.split('/') if parts[0] == 'refs': # strip off 'refs/heads'