Mercurial > hg > hg-git
diff hggit/git_handler.py @ 460:5861777f2f5e
git_handler: fix import_git_objects for Mercurial 2.0+ (issue 36)
This resolves a traceback on pull where hg-git is looking for the
nonexistent repo._tagtypes.
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Wed, 04 Jul 2012 09:39:23 -0500 |
parents | 4ed0d8dac6e7 |
children | 03d8e33bf776 |
line wrap: on
line diff
--- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -597,8 +597,18 @@ 'name' in self._tags: # Mercurial 1.5 and later. del self.repo._tags[name] - if name in self.repo._tagtypes: + if (util.safehasattr(self.repo, '_tagtypes') and + self.repo._tagtypes and + name in self.repo._tagtypes): + # Mercurial 1.9 and earlier. del self.repo._tagtypes[name] + elif (util.safehasattr(self.repo, 'tagscache') and + self.repo.tagscache and + util.safehasattr(self.repo.tagscache, '_tagtypes') and + self.repo.tagscache._tagtypes and + name in self.repo.tagscache._tagtypes): + # Mercurial 2.0 and later. + del self.repo.tagscache._tagtypes[name] def import_git_commit(self, commit): self.ui.debug(_("importing: %s\n") % commit.id)