test-convert: test before() and after() conversion actions
authorPatrick Mezard <pmezard@gmail.com>
Fri, 04 Jan 2008 23:43:55 +0100
changeset 5805 e422305e0853
parent 5804 de8311f7a31b
child 5806 a3a380af8fb5
test-convert: test before() and after() conversion actions
hgext/convert/hg.py
tests/test-convert
tests/test-convert.out
--- a/hgext/convert/hg.py	Fri Jan 04 23:43:55 2008 +0100
+++ b/hgext/convert/hg.py	Fri Jan 04 23:43:55 2008 +0100
@@ -46,11 +46,13 @@
         self.filemapmode = False
 
     def before(self):
+        self.ui.debug(_('run hg sink pre-conversion action\n'))
         self.wlock = self.repo.wlock()
         self.lock = self.repo.lock()
         self.repo.dirstate.clear()
 
     def after(self):
+        self.ui.debug(_('run hg sink post-conversion action\n'))
         self.repo.dirstate.invalidate()
         self.lock = None
         self.wlock = None
@@ -274,3 +276,9 @@
                                   'a')
         self.convertfp.write('%s %s\n' % (destrev, rev))
         self.convertfp.flush()
+
+    def before(self):
+        self.ui.debug(_('run hg source pre-conversion action\n'))
+
+    def after(self):
+        self.ui.debug(_('run hg source post-conversion action\n'))
--- a/tests/test-convert	Fri Jan 04 23:43:55 2008 +0100
+++ b/tests/test-convert	Fri Jan 04 23:43:55 2008 +0100
@@ -39,3 +39,8 @@
 echo % should succeed
 chmod 700 bogusdir
 hg convert a bogusdir
+
+echo % test pre and post conversion actions
+echo 'include b' > filemap
+hg convert --debug --filemap filemap a partialb | \
+    grep 'run hg'
--- a/tests/test-convert.out	Fri Jan 04 23:43:55 2008 +0100
+++ b/tests/test-convert.out	Fri Jan 04 23:43:55 2008 +0100
@@ -112,3 +112,8 @@
 2 c
 1 d
 0 e
+% test pre and post conversion actions
+run hg source pre-conversion action
+run hg sink pre-conversion action
+run hg sink post-conversion action
+run hg source post-conversion action