diff --git a/hggit/gitrepo.py b/hggit/gitrepo.py
index 9965a927998ae4b52667035d66352deebdda749e_aGdnaXQvZ2l0cmVwby5weQ==..367f9e0dc198f1bbf2b7f18023959a46c461b664_aGdnaXQvZ2l0cmVwby5weQ== 100644
--- a/hggit/gitrepo.py
+++ b/hggit/gitrepo.py
@@ -51,10 +51,11 @@
                 handler = self.localrepo.githandler
                 refs = handler.fetch_pack(self.path, heads=[])
                 # map any git shas that exist in hg to hg shas
-                stripped_refs = dict([
-                    (ref[11:], handler.map_hg_get(refs[ref]) or refs[ref])
-                    for ref in refs.keys() if ref.startswith('refs/heads/')
-                ])
+                stripped_refs = {
+                    ref[11:]: handler.map_hg_get(val) or val
+                    for ref, val in refs.iteritems()
+                    if ref.startswith('refs/heads/')
+                }
                 return stripped_refs
         return {}