def _update_references(self, refs):
new_refs = [ref.refname for ref in refs]<EOL>for old_ref in self._discover_refs():<EOL><INDENT>if not old_ref.refname.startswith('<STR_LIT>'):<EOL><INDENT>continue<EOL><DEDENT>if old_ref.refname in new_refs:<EOL><INDENT>continue<EOL><DEDENT>self._update_ref(old_ref, delete=True)<EOL><DEDENT>for new_ref in refs:<EOL><INDENT>refname = new_ref.refname<EOL>if refname.endswith('<STR_LIT>'):<EOL><INDENT>logger.debug("<STR_LIT>",<EOL>refname)<EOL>continue<EOL><DEDENT>elif not refname.startswith('<STR_LIT>') and not refname.startswith('<STR_LIT>'):<EOL><INDENT>logger.debug("<STR_LIT>",<EOL>refname)<EOL>continue<EOL><DEDENT>else:<EOL><INDENT>self._update_ref(new_ref)<EOL><DEDENT><DEDENT>cmd = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>self._exec(cmd, cwd=self.dirpath, env=self.gitenv)<EOL>
Update references removing old ones.