def branch_parents(self):
        parents = {}
        for branch_refspec in [ x.split()[1] for x in self.shell('git', 'show-ref', '--heads').split ]:
            branch_name = '/'.join(branch_refspec.split('/')[2:])
            remote = self.configs.get('branch.%s.remote' % branch_name, '.')
            parent = self.configs.get('branch.%s.merge' % branch_name, '')
            if remote != '.' and parent:
                parent = 'refs/remotes/%s/%s' % (remote, '/'.join(parent.split('/')[2:]))
                parents[branch_refspec] = parent
                parents[parent] = branch_refspec
            else:
                parents[branch_refspec] = parent
        return parents
dataset/ETHPy150Open nowells/git-goggles/gitgoggles/git.py/Repository.branch_parents/original