##// 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 matched. If a match occurs, then the conversion process will
165 matched. If a match occurs, then the conversion process will
166 add the most recent revision on the branch indicated in the
166 add the most recent revision on the branch indicated in the
167 regex as the second parent of the changeset.
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 An additional "debugcvsps" Mercurial command allows the builtin
178 An additional "debugcvsps" Mercurial command allows the builtin
170 changeset merging code to be run without doing a conversion. Its
179 changeset merging code to be run without doing a conversion. Its
@@ -11,6 +11,7 b' import re'
11 import cPickle as pickle
11 import cPickle as pickle
12 from mercurial import util
12 from mercurial import util
13 from mercurial.i18n import _
13 from mercurial.i18n import _
14 from mercurial import hook
14
15
15 class logentry(object):
16 class logentry(object):
16 '''Class logentry has the following attributes:
17 '''Class logentry has the following attributes:
@@ -444,6 +445,8 b' def createlog(ui, directory=None, root="'
444
445
445 ui.status(_('%d log entries\n') % len(log))
446 ui.status(_('%d log entries\n') % len(log))
446
447
448 hook.hook(ui, None, "cvslog", True, log=log)
449
447 return log
450 return log
448
451
449
452
@@ -730,6 +733,8 b' def createchangeset(ui, log, fuzz=60, me'
730
733
731 ui.status(_('%d changeset entries\n') % len(changesets))
734 ui.status(_('%d changeset entries\n') % len(changesets))
732
735
736 hook.hook(ui, None, "cvschangesets", True, changesets=changesets)
737
733 return changesets
738 return changesets
734
739
735
740
@@ -16,10 +16,23 b' echo "[extensions]" >> $HGRCPATH'
16 echo "convert = " >> $HGRCPATH
16 echo "convert = " >> $HGRCPATH
17 echo "graphlog = " >> $HGRCPATH
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 echo % create cvs repository
32 echo % create cvs repository
20 mkdir cvsrepo
33 mkdir cvsrepo
21 cd cvsrepo
34 cd cvsrepo
22 CVSROOT=`pwd`
35 CVSROOT=$PWD
23 export CVSROOT
36 export CVSROOT
24 CVS_OPTIONS=-f
37 CVS_OPTIONS=-f
25 export CVS_OPTIONS
38 export CVS_OPTIONS
@@ -17,8 +17,10 b' connecting to cvsrepo'
17 scanning source...
17 scanning source...
18 collecting CVS rlog
18 collecting CVS rlog
19 5 log entries
19 5 log entries
20 cvslog hook: 5 entries
20 creating changesets
21 creating changesets
21 3 changeset entries
22 3 changeset entries
23 cvschangesets hook: 3 changesets
22 sorting...
24 sorting...
23 converting...
25 converting...
24 2 Initial revision
26 2 Initial revision
@@ -34,8 +36,10 b' connecting to cvsrepo'
34 scanning source...
36 scanning source...
35 collecting CVS rlog
37 collecting CVS rlog
36 5 log entries
38 5 log entries
39 cvslog hook: 5 entries
37 creating changesets
40 creating changesets
38 3 changeset entries
41 3 changeset entries
42 cvschangesets hook: 3 changesets
39 sorting...
43 sorting...
40 converting...
44 converting...
41 2 Initial revision
45 2 Initial revision
@@ -57,8 +61,10 b' connecting to cvsrepo'
57 scanning source...
61 scanning source...
58 collecting CVS rlog
62 collecting CVS rlog
59 7 log entries
63 7 log entries
64 cvslog hook: 7 entries
60 creating changesets
65 creating changesets
61 4 changeset entries
66 4 changeset entries
67 cvschangesets hook: 4 changesets
62 sorting...
68 sorting...
63 converting...
69 converting...
64 0 ci1
70 0 ci1
@@ -72,8 +78,10 b' connecting to cvsrepo'
72 scanning source...
78 scanning source...
73 collecting CVS rlog
79 collecting CVS rlog
74 7 log entries
80 7 log entries
81 cvslog hook: 7 entries
75 creating changesets
82 creating changesets
76 4 changeset entries
83 4 changeset entries
84 cvschangesets hook: 4 changesets
77 sorting...
85 sorting...
78 converting...
86 converting...
79 0 ci1
87 0 ci1
@@ -94,8 +102,10 b' connecting to cvsrepo'
94 scanning source...
102 scanning source...
95 collecting CVS rlog
103 collecting CVS rlog
96 8 log entries
104 8 log entries
105 cvslog hook: 8 entries
97 creating changesets
106 creating changesets
98 5 changeset entries
107 5 changeset entries
108 cvschangesets hook: 5 changesets
99 sorting...
109 sorting...
100 converting...
110 converting...
101 0 ci2
111 0 ci2
@@ -106,8 +116,10 b' connecting to cvsrepo'
106 scanning source...
116 scanning source...
107 collecting CVS rlog
117 collecting CVS rlog
108 8 log entries
118 8 log entries
119 cvslog hook: 8 entries
109 creating changesets
120 creating changesets
110 5 changeset entries
121 5 changeset entries
122 cvschangesets hook: 5 changesets
111 sorting...
123 sorting...
112 converting...
124 converting...
113 0 ci2
125 0 ci2
@@ -125,8 +137,10 b' connecting to cvsrepo'
125 scanning source...
137 scanning source...
126 collecting CVS rlog
138 collecting CVS rlog
127 9 log entries
139 9 log entries
140 cvslog hook: 9 entries
128 creating changesets
141 creating changesets
129 6 changeset entries
142 6 changeset entries
143 cvschangesets hook: 6 changesets
130 sorting...
144 sorting...
131 converting...
145 converting...
132 0 funny
146 0 funny
@@ -148,8 +162,10 b' o 0 () Initial revision files: a b/c'
148 % testing debugcvsps
162 % testing debugcvsps
149 collecting CVS rlog
163 collecting CVS rlog
150 9 log entries
164 9 log entries
165 cvslog hook: 9 entries
151 creating changesets
166 creating changesets
152 8 changeset entries
167 8 changeset entries
168 cvschangesets hook: 8 changesets
153 ---------------------
169 ---------------------
154 PatchSet 1
170 PatchSet 1
155 Date:
171 Date:
@@ -140,6 +140,15 b' convert a foreign SCM repository to a Me'
140 If a match occurs, then the conversion process will add the most
140 If a match occurs, then the conversion process will add the most
141 recent revision on the branch indicated in the regex as the second
141 recent revision on the branch indicated in the regex as the second
142 parent of the changeset.
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 An additional "debugcvsps" Mercurial command allows the builtin changeset
153 An additional "debugcvsps" Mercurial command allows the builtin changeset
145 merging code to be run without doing a conversion. Its parameters and
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