Mercurial > hg > hg-git
diff git_handler.py @ 42:fcfb4db848e1
added hack for pushing first branch
author | Scott Chacon <schacon@gmail.com> |
---|---|
date | Tue, 28 Apr 2009 17:28:04 -0700 (2009-04-29) |
parents | f5b000ec7100 |
children | 3b62270c1fad d274092e3b24 |
line wrap: on
line diff
--- 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'