##// END OF EJS Templates
convert: implement two hooks in builtin cvsps
Frank Kingswood -
r10095:69ce7a10 default
parent child Browse files
Show More
@@ -165,6 +165,15 b' def convert(ui, src, dest=None, revmapfi'
165 165 matched. If a match occurs, then the conversion process will
166 166 add the most recent revision on the branch indicated in the
167 167 regex as the second parent of the changeset.
168 --config hook.cvslog
169 Specify a Python function to be called at the end of gathering
170 the CVS log. The function is passed a list with the log entries,
171 and can modify the entries in-place, or add or delete them.
172 --config hook.cvschangesets
173 Specify a Python function to be called after the changesets
174 are calculated from the the CVS log. The function is passed
175 a list with the changeset entries, and can modify the changesets
176 in-place, or add or delete them.
168 177
169 178 An additional "debugcvsps" Mercurial command allows the builtin
170 179 changeset merging code to be run without doing a conversion. Its
@@ -11,6 +11,7 b' import re'
11 11 import cPickle as pickle
12 12 from mercurial import util
13 13 from mercurial.i18n import _
14 from mercurial import hook
14 15
15 16 class logentry(object):
16 17 '''Class logentry has the following attributes:
@@ -444,6 +445,8 b' def createlog(ui, directory=None, root="'
444 445
445 446 ui.status(_('%d log entries\n') % len(log))
446 447
448 hook.hook(ui, None, "cvslog", True, log=log)
449
447 450 return log
448 451
449 452
@@ -730,6 +733,8 b' def createchangeset(ui, log, fuzz=60, me'
730 733
731 734 ui.status(_('%d changeset entries\n') % len(changesets))
732 735
736 hook.hook(ui, None, "cvschangesets", True, changesets=changesets)
737
733 738 return changesets
734 739
735 740
@@ -16,10 +16,23 b' echo "[extensions]" >> $HGRCPATH'
16 16 echo "convert = " >> $HGRCPATH
17 17 echo "graphlog = " >> $HGRCPATH
18 18
19 cat > cvshooks.py <<EOF
20 def cvslog(ui,repo,hooktype,log):
21 print "%s hook: %d entries"%(hooktype,len(log))
22
23 def cvschangesets(ui,repo,hooktype,changesets):
24 print "%s hook: %d changesets"%(hooktype,len(changesets))
25 EOF
26 hookpath=$PWD
27
28 echo "[hooks]" >> $HGRCPATH
29 echo "cvslog=python:$hookpath/cvshooks.py:cvslog" >> $HGRCPATH
30 echo "cvschangesets=python:$hookpath/cvshooks.py:cvschangesets" >> $HGRCPATH
31
19 32 echo % create cvs repository
20 33 mkdir cvsrepo
21 34 cd cvsrepo
22 CVSROOT=`pwd`
35 CVSROOT=$PWD
23 36 export CVSROOT
24 37 CVS_OPTIONS=-f
25 38 export CVS_OPTIONS
@@ -17,8 +17,10 b' connecting to cvsrepo'
17 17 scanning source...
18 18 collecting CVS rlog
19 19 5 log entries
20 cvslog hook: 5 entries
20 21 creating changesets
21 22 3 changeset entries
23 cvschangesets hook: 3 changesets
22 24 sorting...
23 25 converting...
24 26 2 Initial revision
@@ -34,8 +36,10 b' connecting to cvsrepo'
34 36 scanning source...
35 37 collecting CVS rlog
36 38 5 log entries
39 cvslog hook: 5 entries
37 40 creating changesets
38 41 3 changeset entries
42 cvschangesets hook: 3 changesets
39 43 sorting...
40 44 converting...
41 45 2 Initial revision
@@ -57,8 +61,10 b' connecting to cvsrepo'
57 61 scanning source...
58 62 collecting CVS rlog
59 63 7 log entries
64 cvslog hook: 7 entries
60 65 creating changesets
61 66 4 changeset entries
67 cvschangesets hook: 4 changesets
62 68 sorting...
63 69 converting...
64 70 0 ci1
@@ -72,8 +78,10 b' connecting to cvsrepo'
72 78 scanning source...
73 79 collecting CVS rlog
74 80 7 log entries
81 cvslog hook: 7 entries
75 82 creating changesets
76 83 4 changeset entries
84 cvschangesets hook: 4 changesets
77 85 sorting...
78 86 converting...
79 87 0 ci1
@@ -94,8 +102,10 b' connecting to cvsrepo'
94 102 scanning source...
95 103 collecting CVS rlog
96 104 8 log entries
105 cvslog hook: 8 entries
97 106 creating changesets
98 107 5 changeset entries
108 cvschangesets hook: 5 changesets
99 109 sorting...
100 110 converting...
101 111 0 ci2
@@ -106,8 +116,10 b' connecting to cvsrepo'
106 116 scanning source...
107 117 collecting CVS rlog
108 118 8 log entries
119 cvslog hook: 8 entries
109 120 creating changesets
110 121 5 changeset entries
122 cvschangesets hook: 5 changesets
111 123 sorting...
112 124 converting...
113 125 0 ci2
@@ -125,8 +137,10 b' connecting to cvsrepo'
125 137 scanning source...
126 138 collecting CVS rlog
127 139 9 log entries
140 cvslog hook: 9 entries
128 141 creating changesets
129 142 6 changeset entries
143 cvschangesets hook: 6 changesets
130 144 sorting...
131 145 converting...
132 146 0 funny
@@ -148,8 +162,10 b' o 0 () Initial revision files: a b/c'
148 162 % testing debugcvsps
149 163 collecting CVS rlog
150 164 9 log entries
165 cvslog hook: 9 entries
151 166 creating changesets
152 167 8 changeset entries
168 cvschangesets hook: 8 changesets
153 169 ---------------------
154 170 PatchSet 1
155 171 Date:
@@ -140,6 +140,15 b' convert a foreign SCM repository to a Me'
140 140 If a match occurs, then the conversion process will add the most
141 141 recent revision on the branch indicated in the regex as the second
142 142 parent of the changeset.
143 --config hook.cvslog
144 Specify a Python function to be called at the end of gathering the CVS
145 log. The function is passed a list with the log entries, and can
146 modify the entries in-place, or add or delete them.
147 --config hook.cvschangesets
148 Specify a Python function to be called after the changesets are
149 calculated from the the CVS log. The function is passed a list with
150 the changeset entries, and can modify the changesets in-place, or add
151 or delete them.
143 152
144 153 An additional "debugcvsps" Mercurial command allows the builtin changeset
145 154 merging code to be run without doing a conversion. Its parameters and
General Comments 0
You need to be logged in to leave comments. Login now