--- a/hgext/convert/__init__.py Wed Dec 16 17:39:42 2009 -0600
+++ b/hgext/convert/__init__.py Fri Dec 18 14:27:30 2009 -0600
@@ -165,6 +165,15 @@
matched. If a match occurs, then the conversion process will
add the most recent revision on the branch indicated in the
regex as the second parent of the changeset.
+ --config hook.cvslog
+ Specify a Python function to be called at the end of gathering
+ the CVS log. The function is passed a list with the log entries,
+ and can modify the entries in-place, or add or delete them.
+ --config hook.cvschangesets
+ Specify a Python function to be called after the changesets
+ are calculated from the the CVS log. The function is passed
+ a list with the changeset entries, and can modify the changesets
+ in-place, or add or delete them.
An additional "debugcvsps" Mercurial command allows the builtin
changeset merging code to be run without doing a conversion. Its
--- a/hgext/convert/cvsps.py Wed Dec 16 17:39:42 2009 -0600
+++ b/hgext/convert/cvsps.py Fri Dec 18 14:27:30 2009 -0600
@@ -11,6 +11,7 @@
import cPickle as pickle
from mercurial import util
from mercurial.i18n import _
+from mercurial import hook
class logentry(object):
'''Class logentry has the following attributes:
@@ -444,6 +445,8 @@
ui.status(_('%d log entries\n') % len(log))
+ hook.hook(ui, None, "cvslog", True, log=log)
+
return log
@@ -730,6 +733,8 @@
ui.status(_('%d changeset entries\n') % len(changesets))
+ hook.hook(ui, None, "cvschangesets", True, changesets=changesets)
+
return changesets
--- a/tests/test-convert-cvs Wed Dec 16 17:39:42 2009 -0600
+++ b/tests/test-convert-cvs Fri Dec 18 14:27:30 2009 -0600
@@ -16,10 +16,23 @@
echo "convert = " >> $HGRCPATH
echo "graphlog = " >> $HGRCPATH
+cat > cvshooks.py <<EOF
+def cvslog(ui,repo,hooktype,log):
+ print "%s hook: %d entries"%(hooktype,len(log))
+
+def cvschangesets(ui,repo,hooktype,changesets):
+ print "%s hook: %d changesets"%(hooktype,len(changesets))
+EOF
+hookpath=$PWD
+
+echo "[hooks]" >> $HGRCPATH
+echo "cvslog=python:$hookpath/cvshooks.py:cvslog" >> $HGRCPATH
+echo "cvschangesets=python:$hookpath/cvshooks.py:cvschangesets" >> $HGRCPATH
+
echo % create cvs repository
mkdir cvsrepo
cd cvsrepo
-CVSROOT=`pwd`
+CVSROOT=$PWD
export CVSROOT
CVS_OPTIONS=-f
export CVS_OPTIONS
--- a/tests/test-convert-cvs.out Wed Dec 16 17:39:42 2009 -0600
+++ b/tests/test-convert-cvs.out Fri Dec 18 14:27:30 2009 -0600
@@ -17,8 +17,10 @@
scanning source...
collecting CVS rlog
5 log entries
+cvslog hook: 5 entries
creating changesets
3 changeset entries
+cvschangesets hook: 3 changesets
sorting...
converting...
2 Initial revision
@@ -34,8 +36,10 @@
scanning source...
collecting CVS rlog
5 log entries
+cvslog hook: 5 entries
creating changesets
3 changeset entries
+cvschangesets hook: 3 changesets
sorting...
converting...
2 Initial revision
@@ -57,8 +61,10 @@
scanning source...
collecting CVS rlog
7 log entries
+cvslog hook: 7 entries
creating changesets
4 changeset entries
+cvschangesets hook: 4 changesets
sorting...
converting...
0 ci1
@@ -72,8 +78,10 @@
scanning source...
collecting CVS rlog
7 log entries
+cvslog hook: 7 entries
creating changesets
4 changeset entries
+cvschangesets hook: 4 changesets
sorting...
converting...
0 ci1
@@ -94,8 +102,10 @@
scanning source...
collecting CVS rlog
8 log entries
+cvslog hook: 8 entries
creating changesets
5 changeset entries
+cvschangesets hook: 5 changesets
sorting...
converting...
0 ci2
@@ -106,8 +116,10 @@
scanning source...
collecting CVS rlog
8 log entries
+cvslog hook: 8 entries
creating changesets
5 changeset entries
+cvschangesets hook: 5 changesets
sorting...
converting...
0 ci2
@@ -125,8 +137,10 @@
scanning source...
collecting CVS rlog
9 log entries
+cvslog hook: 9 entries
creating changesets
6 changeset entries
+cvschangesets hook: 6 changesets
sorting...
converting...
0 funny
@@ -148,8 +162,10 @@
% testing debugcvsps
collecting CVS rlog
9 log entries
+cvslog hook: 9 entries
creating changesets
8 changeset entries
+cvschangesets hook: 8 changesets
---------------------
PatchSet 1
Date:
--- a/tests/test-convert.out Wed Dec 16 17:39:42 2009 -0600
+++ b/tests/test-convert.out Fri Dec 18 14:27:30 2009 -0600
@@ -140,6 +140,15 @@
If a match occurs, then the conversion process will add the most
recent revision on the branch indicated in the regex as the second
parent of the changeset.
+ --config hook.cvslog
+ Specify a Python function to be called at the end of gathering the CVS
+ log. The function is passed a list with the log entries, and can
+ modify the entries in-place, or add or delete them.
+ --config hook.cvschangesets
+ Specify a Python function to be called after the changesets are
+ calculated from the the CVS log. The function is passed a list with
+ the changeset entries, and can modify the changesets in-place, or add
+ or delete them.
An additional "debugcvsps" Mercurial command allows the builtin changeset
merging code to be run without doing a conversion. Its parameters and