##// END OF EJS Templates
convert/cvs: delay CVS log parsing after initialization (issue1581/2)...
Patrick Mezard -
r8048:d22432bd default
parent child Browse files
Show More
@@ -24,7 +24,7 b' class convert_cvs(converter_source):'
24 if not self.builtin:
24 if not self.builtin:
25 checktool(cvspsexe)
25 checktool(cvspsexe)
26
26
27 self.changeset = {}
27 self.changeset = None
28 self.files = {}
28 self.files = {}
29 self.tags = {}
29 self.tags = {}
30 self.lastbranch = {}
30 self.lastbranch = {}
@@ -34,12 +34,12 b' class convert_cvs(converter_source):'
34 self.cvsrepo = file(os.path.join(cvs, "Repository")).read()[:-1]
34 self.cvsrepo = file(os.path.join(cvs, "Repository")).read()[:-1]
35 self.encoding = locale.getpreferredencoding()
35 self.encoding = locale.getpreferredencoding()
36
36
37 self._parse(ui)
38 self._connect()
37 self._connect()
39
38
40 def _parse(self, ui):
39 def _parse(self):
41 if self.changeset:
40 if self.changeset is not None:
42 return
41 return
42 self.changeset = {}
43
43
44 maxrev = 0
44 maxrev = 0
45 cmd = self.cmd
45 cmd = self.cmd
@@ -65,13 +65,13 b' class convert_cvs(converter_source):'
65
65
66 if self.builtin:
66 if self.builtin:
67 # builtin cvsps code
67 # builtin cvsps code
68 ui.status(_('using builtin cvsps\n'))
68 self.ui.status(_('using builtin cvsps\n'))
69
69
70 db = cvsps.createlog(ui, cache='update')
70 db = cvsps.createlog(self.ui, cache='update')
71 db = cvsps.createchangeset(ui, db,
71 db = cvsps.createchangeset(self.ui, db,
72 fuzz=int(ui.config('convert', 'cvsps.fuzz', 60)),
72 fuzz=int(self.ui.config('convert', 'cvsps.fuzz', 60)),
73 mergeto=ui.config('convert', 'cvsps.mergeto', None),
73 mergeto=self.ui.config('convert', 'cvsps.mergeto', None),
74 mergefrom=ui.config('convert', 'cvsps.mergefrom', None))
74 mergefrom=self.ui.config('convert', 'cvsps.mergefrom', None))
75
75
76 for cs in db:
76 for cs in db:
77 if maxrev and cs.id>maxrev:
77 if maxrev and cs.id>maxrev:
@@ -278,6 +278,7 b' class convert_cvs(converter_source):'
278 r = self.readp.readline()
278 r = self.readp.readline()
279
279
280 def getheads(self):
280 def getheads(self):
281 self._parse()
281 return self.heads
282 return self.heads
282
283
283 def _getfile(self, name, rev):
284 def _getfile(self, name, rev):
@@ -332,6 +333,7 b' class convert_cvs(converter_source):'
332 raise util.Abort(_("unknown CVS response: %s") % line)
333 raise util.Abort(_("unknown CVS response: %s") % line)
333
334
334 def getfile(self, file, rev):
335 def getfile(self, file, rev):
336 self._parse()
335 data, mode = self._getfile(file, rev)
337 data, mode = self._getfile(file, rev)
336 self.modecache[(file, rev)] = mode
338 self.modecache[(file, rev)] = mode
337 return data
339 return data
@@ -340,14 +342,18 b' class convert_cvs(converter_source):'
340 return self.modecache[(file, rev)]
342 return self.modecache[(file, rev)]
341
343
342 def getchanges(self, rev):
344 def getchanges(self, rev):
345 self._parse()
343 self.modecache = {}
346 self.modecache = {}
344 return util.sort(self.files[rev].items()), {}
347 return util.sort(self.files[rev].items()), {}
345
348
346 def getcommit(self, rev):
349 def getcommit(self, rev):
350 self._parse()
347 return self.changeset[rev]
351 return self.changeset[rev]
348
352
349 def gettags(self):
353 def gettags(self):
354 self._parse()
350 return self.tags
355 return self.tags
351
356
352 def getchangedfiles(self, rev, i):
357 def getchangedfiles(self, rev, i):
358 self._parse()
353 return util.sort(self.files[rev].keys())
359 return util.sort(self.files[rev].keys())
@@ -23,13 +23,13 b' checking in src/a,v'
23 % Convert
23 % Convert
24 assuming destination src-hg
24 assuming destination src-hg
25 initializing destination src-hg repository
25 initializing destination src-hg repository
26 connecting to cvsrepo
27 scanning source...
26 using builtin cvsps
28 using builtin cvsps
27 collecting CVS rlog
29 collecting CVS rlog
28 7 log entries
30 7 log entries
29 creating changesets
31 creating changesets
30 5 changeset entries
32 5 changeset entries
31 connecting to cvsrepo
32 scanning source...
33 sorting...
33 sorting...
34 converting...
34 converting...
35 4 Initial revision
35 4 Initial revision
@@ -13,13 +13,13 b' U src/b/c'
13 checking in src/b/c,v
13 checking in src/b/c,v
14 % convert fresh repo
14 % convert fresh repo
15 initializing destination src-hg repository
15 initializing destination src-hg repository
16 connecting to cvsrepo
17 scanning source...
16 using builtin cvsps
18 using builtin cvsps
17 collecting CVS rlog
19 collecting CVS rlog
18 5 log entries
20 5 log entries
19 creating changesets
21 creating changesets
20 3 changeset entries
22 3 changeset entries
21 connecting to cvsrepo
22 scanning source...
23 sorting...
23 sorting...
24 converting...
24 converting...
25 2 Initial revision
25 2 Initial revision
@@ -31,13 +31,13 b' c'
31 c
31 c
32 % convert fresh repo with --filemap
32 % convert fresh repo with --filemap
33 initializing destination src-filemap repository
33 initializing destination src-filemap repository
34 connecting to cvsrepo
35 scanning source...
34 using builtin cvsps
36 using builtin cvsps
35 collecting CVS rlog
37 collecting CVS rlog
36 5 log entries
38 5 log entries
37 creating changesets
39 creating changesets
38 3 changeset entries
40 3 changeset entries
39 connecting to cvsrepo
40 scanning source...
41 sorting...
41 sorting...
42 converting...
42 converting...
43 2 Initial revision
43 2 Initial revision
@@ -54,13 +54,13 b' 0 Initial revision files: b/c'
54 checking in src/a,v
54 checking in src/a,v
55 checking in src/b/c,v
55 checking in src/b/c,v
56 % convert again
56 % convert again
57 connecting to cvsrepo
58 scanning source...
57 using builtin cvsps
59 using builtin cvsps
58 collecting CVS rlog
60 collecting CVS rlog
59 7 log entries
61 7 log entries
60 creating changesets
62 creating changesets
61 4 changeset entries
63 4 changeset entries
62 connecting to cvsrepo
63 scanning source...
64 sorting...
64 sorting...
65 converting...
65 converting...
66 0 ci1
66 0 ci1
@@ -70,13 +70,13 b' c'
70 c
70 c
71 c
71 c
72 % convert again with --filemap
72 % convert again with --filemap
73 connecting to cvsrepo
74 scanning source...
73 using builtin cvsps
75 using builtin cvsps
74 collecting CVS rlog
76 collecting CVS rlog
75 7 log entries
77 7 log entries
76 creating changesets
78 creating changesets
77 4 changeset entries
79 4 changeset entries
78 connecting to cvsrepo
79 scanning source...
80 sorting...
80 sorting...
81 converting...
81 converting...
82 0 ci1
82 0 ci1
@@ -93,13 +93,13 b' T a'
93 T b/c
93 T b/c
94 checking in src/b/c,v
94 checking in src/b/c,v
95 % convert again
95 % convert again
96 connecting to cvsrepo
97 scanning source...
96 using builtin cvsps
98 using builtin cvsps
97 collecting CVS rlog
99 collecting CVS rlog
98 8 log entries
100 8 log entries
99 creating changesets
101 creating changesets
100 5 changeset entries
102 5 changeset entries
101 connecting to cvsrepo
102 scanning source...
103 sorting...
103 sorting...
104 converting...
104 converting...
105 0 ci2
105 0 ci2
@@ -107,13 +107,13 b' a'
107 c
107 c
108 d
108 d
109 % convert again with --filemap
109 % convert again with --filemap
110 connecting to cvsrepo
111 scanning source...
110 using builtin cvsps
112 using builtin cvsps
111 collecting CVS rlog
113 collecting CVS rlog
112 8 log entries
114 8 log entries
113 creating changesets
115 creating changesets
114 5 changeset entries
116 5 changeset entries
115 connecting to cvsrepo
116 scanning source...
117 sorting...
117 sorting...
118 converting...
118 converting...
119 0 ci2
119 0 ci2
@@ -127,13 +127,13 b' 0 Initial revision files: b/c'
127 % commit a new revision with funny log message
127 % commit a new revision with funny log message
128 checking in src/a,v
128 checking in src/a,v
129 % convert again
129 % convert again
130 connecting to cvsrepo
131 scanning source...
130 using builtin cvsps
132 using builtin cvsps
131 collecting CVS rlog
133 collecting CVS rlog
132 9 log entries
134 9 log entries
133 creating changesets
135 creating changesets
134 6 changeset entries
136 6 changeset entries
135 connecting to cvsrepo
136 scanning source...
137 sorting...
137 sorting...
138 converting...
138 converting...
139 0 funny
139 0 funny
@@ -34,13 +34,13 b' cvs commit: Examining .'
34 new revision: 1.1.4.2; previous revision: 1.1.4.1
34 new revision: 1.1.4.2; previous revision: 1.1.4.1
35 % convert to hg
35 % convert to hg
36 initializing destination proj.hg repository
36 initializing destination proj.hg repository
37 connecting to *REPO*
38 scanning source...
37 using builtin cvsps
39 using builtin cvsps
38 collecting CVS rlog
40 collecting CVS rlog
39 9 log entries
41 9 log entries
40 creating changesets
42 creating changesets
41 4 changeset entries
43 4 changeset entries
42 connecting to *REPO*
43 scanning source...
44 sorting...
44 sorting...
45 converting...
45 converting...
46 3 add file1 on trunk
46 3 add file1 on trunk
General Comments 0
You need to be logged in to leave comments. Login now