comparison hggit/git_handler.py @ 773:55887ce9fb98

git_handler.update_remote_branches: rename 'tags' to 'remote_refs' 'tags' is a fairly nonsensical name in this context.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 03 Sep 2014 19:47:37 +0200
parents 03e1e9929dea
children 9c6bd4102ef5
comparison
equal deleted inserted replaced
772:03e1e9929dea 773:55887ce9fb98
1256 self.ui.warn(_('creating bookmarks failed, do you have' 1256 self.ui.warn(_('creating bookmarks failed, do you have'
1257 ' bookmarks enabled?\n')) 1257 ' bookmarks enabled?\n'))
1258 1258
1259 def update_remote_branches(self, remote_name, refs): 1259 def update_remote_branches(self, remote_name, refs):
1260 tagfile = self.repo.join(self.remote_refs_file) 1260 tagfile = self.repo.join(self.remote_refs_file)
1261 tags = self.remote_refs 1261 remote_refs = self.remote_refs
1262 # since we re-write all refs for this remote each time, prune 1262 # since we re-write all refs for this remote each time, prune
1263 # all entries matching this remote from our tags list now so 1263 # all entries matching this remote from our refs list now so
1264 # that we avoid any stale refs hanging around forever 1264 # that we avoid any stale refs hanging around forever
1265 for t in list(tags): 1265 for t in list(remote_refs):
1266 if t.startswith(remote_name + '/'): 1266 if t.startswith(remote_name + '/'):
1267 del tags[t] 1267 del remote_refs[t]
1268 store = self.git.object_store 1268 store = self.git.object_store
1269 for ref_name, sha in refs.iteritems(): 1269 for ref_name, sha in refs.iteritems():
1270 if ref_name.startswith('refs/heads'): 1270 if ref_name.startswith('refs/heads'):
1271 hgsha = self.map_hg_get(sha) 1271 hgsha = self.map_hg_get(sha)
1272 if hgsha is None or hgsha not in self.repo: 1272 if hgsha is None or hgsha not in self.repo:
1273 continue 1273 continue
1274 head = ref_name[11:] 1274 head = ref_name[11:]
1275 tags['/'.join((remote_name, head))] = bin(hgsha) 1275 remote_refs['/'.join((remote_name, head))] = bin(hgsha)
1276 # TODO(durin42): what is this doing? 1276 # TODO(durin42): what is this doing?
1277 new_ref = 'refs/remotes/%s/%s' % (remote_name, head) 1277 new_ref = 'refs/remotes/%s/%s' % (remote_name, head)
1278 self.git.refs[new_ref] = sha 1278 self.git.refs[new_ref] = sha
1279 elif (ref_name.startswith('refs/tags') 1279 elif (ref_name.startswith('refs/tags')
1280 and not ref_name.endswith('^{}')): 1280 and not ref_name.endswith('^{}')):