changeset 587:1ab57b19cb3a

git_handler: defend against unexported revisions in tag exporting
author Augie Fackler <raf@durin42.com>
date Sun, 11 Nov 2012 15:46:19 -0600
parents 6ebbe6c8b794
children 4d9e2d2a2c19 96e75caaf900
files hggit/git_handler.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -937,8 +937,14 @@
         for tag, sha in self.repo.tags().iteritems():
             if self.repo.tagtype(tag) in ('global', 'git'):
                 tag = tag.replace(' ', '_')
-                self.git.refs['refs/tags/' + tag] = self.map_git_get(hex(sha))
-                self.tags[tag] = hex(sha)
+                target = self.map_git_get(hex(sha))
+                if target is not None:
+                    self.git.refs['refs/tags/' + tag] = target
+                    self.tags[tag] = hex(sha)
+                else:
+                    self.repo.ui.warn(
+                        'Skipping export of tag %s because it '
+                        'has no matching git revision.' % tag)
 
     def _filter_for_bookmarks(self, bms):
         if not self.branch_bookmark_suffix: