changeset 5356:f0931c0240b4

convert: add before/after hooks for converter sources
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 02 Oct 2007 13:46:17 -0700
parents cc34be74eeec
children c6adf2be6069
files hgext/convert/__init__.py hgext/convert/common.py
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/__init__.py	Sat Sep 29 21:10:54 2007 -0700
+++ b/hgext/convert/__init__.py	Tue Oct 02 13:46:17 2007 -0700
@@ -235,6 +235,7 @@
 
     def convert(self):
         try:
+            self.source.before()
             self.dest.before()
             self.source.setrevmap(self.map)
             self.ui.status("scanning source...\n")
@@ -273,7 +274,10 @@
             self.cleanup()
 
     def cleanup(self):
-        self.dest.after()
+        try:
+            self.dest.after()
+        finally:
+            self.source.after()
         if self.revmapfilefd:
             self.revmapfilefd.close()
 
--- a/hgext/convert/common.py	Sat Sep 29 21:10:54 2007 -0700
+++ b/hgext/convert/common.py	Tue Oct 02 13:46:17 2007 -0700
@@ -38,6 +38,12 @@
 
         self.encoding = 'utf-8'
 
+    def before(self):
+        pass
+
+    def after(self):
+        pass
+
     def setrevmap(self, revmap):
         """set the map of already-converted revisions"""
         pass