diff --git a/hgext/convert/cvs.py b/hgext/convert/cvs.py --- a/hgext/convert/cvs.py +++ b/hgext/convert/cvs.py @@ -24,7 +24,7 @@ class convert_cvs(converter_source): if not self.builtin: checktool(cvspsexe) - self.changeset = {} + self.changeset = None self.files = {} self.tags = {} self.lastbranch = {} @@ -34,12 +34,12 @@ class convert_cvs(converter_source): self.cvsrepo = file(os.path.join(cvs, "Repository")).read()[:-1] self.encoding = locale.getpreferredencoding() - self._parse(ui) self._connect() - def _parse(self, ui): - if self.changeset: + def _parse(self): + if self.changeset is not None: return + self.changeset = {} maxrev = 0 cmd = self.cmd @@ -65,13 +65,13 @@ class convert_cvs(converter_source): if self.builtin: # builtin cvsps code - ui.status(_('using builtin cvsps\n')) + self.ui.status(_('using builtin cvsps\n')) - db = cvsps.createlog(ui, cache='update') - db = cvsps.createchangeset(ui, db, - fuzz=int(ui.config('convert', 'cvsps.fuzz', 60)), - mergeto=ui.config('convert', 'cvsps.mergeto', None), - mergefrom=ui.config('convert', 'cvsps.mergefrom', None)) + db = cvsps.createlog(self.ui, cache='update') + db = cvsps.createchangeset(self.ui, db, + fuzz=int(self.ui.config('convert', 'cvsps.fuzz', 60)), + mergeto=self.ui.config('convert', 'cvsps.mergeto', None), + mergefrom=self.ui.config('convert', 'cvsps.mergefrom', None)) for cs in db: if maxrev and cs.id>maxrev: @@ -278,6 +278,7 @@ class convert_cvs(converter_source): r = self.readp.readline() def getheads(self): + self._parse() return self.heads def _getfile(self, name, rev): @@ -332,6 +333,7 @@ class convert_cvs(converter_source): raise util.Abort(_("unknown CVS response: %s") % line) def getfile(self, file, rev): + self._parse() data, mode = self._getfile(file, rev) self.modecache[(file, rev)] = mode return data @@ -340,14 +342,18 @@ class convert_cvs(converter_source): return self.modecache[(file, rev)] def getchanges(self, rev): + self._parse() self.modecache = {} return util.sort(self.files[rev].items()), {} def getcommit(self, rev): + self._parse() return self.changeset[rev] def gettags(self): + self._parse() return self.tags def getchangedfiles(self, rev, i): + self._parse() return util.sort(self.files[rev].keys()) diff --git a/tests/test-convert-cvs-branch.out b/tests/test-convert-cvs-branch.out --- a/tests/test-convert-cvs-branch.out +++ b/tests/test-convert-cvs-branch.out @@ -23,13 +23,13 @@ checking in src/a,v % Convert assuming destination src-hg initializing destination src-hg repository +connecting to cvsrepo +scanning source... using builtin cvsps collecting CVS rlog 7 log entries creating changesets 5 changeset entries -connecting to cvsrepo -scanning source... sorting... converting... 4 Initial revision diff --git a/tests/test-convert-cvs-builtincvsps.out b/tests/test-convert-cvs-builtincvsps.out --- a/tests/test-convert-cvs-builtincvsps.out +++ b/tests/test-convert-cvs-builtincvsps.out @@ -13,13 +13,13 @@ U src/b/c checking in src/b/c,v % convert fresh repo initializing destination src-hg repository +connecting to cvsrepo +scanning source... using builtin cvsps collecting CVS rlog 5 log entries creating changesets 3 changeset entries -connecting to cvsrepo -scanning source... sorting... converting... 2 Initial revision @@ -31,13 +31,13 @@ c c % convert fresh repo with --filemap initializing destination src-filemap repository +connecting to cvsrepo +scanning source... using builtin cvsps collecting CVS rlog 5 log entries creating changesets 3 changeset entries -connecting to cvsrepo -scanning source... sorting... converting... 2 Initial revision @@ -54,13 +54,13 @@ 0 Initial revision files: b/c checking in src/a,v checking in src/b/c,v % convert again +connecting to cvsrepo +scanning source... using builtin cvsps collecting CVS rlog 7 log entries creating changesets 4 changeset entries -connecting to cvsrepo -scanning source... sorting... converting... 0 ci1 @@ -70,13 +70,13 @@ c c c % convert again with --filemap +connecting to cvsrepo +scanning source... using builtin cvsps collecting CVS rlog 7 log entries creating changesets 4 changeset entries -connecting to cvsrepo -scanning source... sorting... converting... 0 ci1 @@ -93,13 +93,13 @@ T a T b/c checking in src/b/c,v % convert again +connecting to cvsrepo +scanning source... using builtin cvsps collecting CVS rlog 8 log entries creating changesets 5 changeset entries -connecting to cvsrepo -scanning source... sorting... converting... 0 ci2 @@ -107,13 +107,13 @@ a c d % convert again with --filemap +connecting to cvsrepo +scanning source... using builtin cvsps collecting CVS rlog 8 log entries creating changesets 5 changeset entries -connecting to cvsrepo -scanning source... sorting... converting... 0 ci2 @@ -127,13 +127,13 @@ 0 Initial revision files: b/c % commit a new revision with funny log message checking in src/a,v % convert again +connecting to cvsrepo +scanning source... using builtin cvsps collecting CVS rlog 9 log entries creating changesets 6 changeset entries -connecting to cvsrepo -scanning source... sorting... converting... 0 funny diff --git a/tests/test-convert-cvs-synthetic.out b/tests/test-convert-cvs-synthetic.out --- a/tests/test-convert-cvs-synthetic.out +++ b/tests/test-convert-cvs-synthetic.out @@ -34,13 +34,13 @@ cvs commit: Examining . new revision: 1.1.4.2; previous revision: 1.1.4.1 % convert to hg initializing destination proj.hg repository +connecting to *REPO* +scanning source... using builtin cvsps collecting CVS rlog 9 log entries creating changesets 4 changeset entries -connecting to *REPO* -scanning source... sorting... converting... 3 add file1 on trunk