comparison git_handler.py @ 126:705b88c9f3d1

remote branches to server
author Ian Dees <undees@gmail.com>
date Sun, 17 May 2009 16:42:34 -0700
parents 5b702bbf078f
children 695a90e72e4f
comparison
equal deleted inserted replaced
125:5b702bbf078f 126:705b88c9f3d1
173 pass 173 pass
174 174
175 c = self.map_git_get(hex(self.repo.changelog.tip())) 175 c = self.map_git_get(hex(self.repo.changelog.tip()))
176 self.git.set_ref('refs/heads/master', c) 176 self.git.set_ref('refs/heads/master', c)
177 177
178 # Make sure there's a refs/remotes/remote_name/name
179 # for every refs/heads/name
178 def update_remote_references(self, remote_name): 180 def update_remote_references(self, remote_name):
181 self.git.set_remote_refs(self.local_heads(), remote_name)
182
183 def local_heads(self):
179 def is_local_head(item): return item[0].startswith('refs/heads') 184 def is_local_head(item): return item[0].startswith('refs/heads')
180 refs = self.git.get_refs() 185 refs = self.git.get_refs()
181 heads = dict(filter(is_local_head, refs.items())) 186 return dict(filter(is_local_head, refs.items()))
182
183 self.git.set_remote_refs(heads, remote_name)
184 187
185 def export_git_objects(self): 188 def export_git_objects(self):
186 self.ui.status(_("exporting git objects\n")) 189 self.ui.status(_("exporting git objects\n"))
187 total = len(self.repo.changelog) 190 total = len(self.repo.changelog)
188 magnitude = int(math.log(total, 10)) + 1 if total else 1 191 magnitude = int(math.log(total, 10)) + 1 if total else 1
387 head = "/".join([v for v in parts[2:]]) 390 head = "/".join([v for v in parts[2:]])
388 local_ref = self.git.ref(ref_name) 391 local_ref = self.git.ref(ref_name)
389 if local_ref: 392 if local_ref:
390 if not local_ref == refs[ref_name]: 393 if not local_ref == refs[ref_name]:
391 changed[ref_name] = local_ref 394 changed[ref_name] = local_ref
395
396 # Also push any local branches not on the server yet
397 for head in self.local_heads():
398 if not head in refs:
399 ref = self.git.ref(head)
400 changed[head] = ref
401
392 return changed 402 return changed
393 403
394 # takes a list of shas the server wants and shas the server has 404 # takes a list of shas the server wants and shas the server has
395 # and generates a list of commit shas we need to push up 405 # and generates a list of commit shas we need to push up
396 def generate_pack_contents(self, want, have): 406 def generate_pack_contents(self, want, have):