def main(self): """ Main function. """ oDb = TMDatabaseConnection() oLogic = VcsRevisionLogic(oDb) # Where to start. iStartRev = 0 if not self.oConfig.fFull: iStartRev = oLogic.getLastRevision(self.oConfig.sRepository) if iStartRev == 0: iStartRev = self.oConfig.iStartRevision # Construct a command line. os.environ['LC_ALL'] = 'en_US.utf-8' asArgs = [ 'svn', 'log', '--xml', '--revision', str(iStartRev) + ':HEAD', ] if self.oConfig.asExtraOptions is not None: asArgs.extend(self.oConfig.asExtraOptions) asArgs.append(self.oConfig.sUrl) if not self.oConfig.fQuiet: print('Executing: %s' % (asArgs, )) sLogXml = utils.processOutputChecked(asArgs) # Parse the XML and add the entries to the database. oParser = ET.XMLParser(target=ET.TreeBuilder(), encoding='utf-8') oParser.feed(sLogXml.encode('utf-8')) # does its own decoding and processOutputChecked always gives us decoded utf-8 now. oRoot = oParser.close() for oLogEntry in oRoot.findall('logentry'): iRevision = int(oLogEntry.get('revision')) sAuthor = oLogEntry.findtext('author').strip() sDate = oLogEntry.findtext('date').strip() sMessage = oLogEntry.findtext('msg', '').strip() if sMessage == '': sMessage = ' ' elif len(sMessage) > VcsRevisionData.kcchMax_sMessage: sMessage = sMessage[:VcsRevisionData.kcchMax_sMessage - 4] + ' ...' if not self.oConfig.fQuiet: utils.printOut(u'sDate=%s iRev=%u sAuthor=%s sMsg[%s]=%s' % (sDate, iRevision, sAuthor, type(sMessage).__name__, sMessage)) oData = VcsRevisionData().initFromValues(self.oConfig.sRepository, iRevision, sDate, sAuthor, sMessage) oLogic.addVcsRevision(oData) oDb.commit() oDb.close() return 0
def main(self): """ Main function. """ oDb = TMDatabaseConnection(); oLogic = VcsRevisionLogic(oDb); # Where to start. iStartRev = 0; if not self.oConfig.fFull: iStartRev = oLogic.getLastRevision(self.oConfig.sRepository); if iStartRev == 0: iStartRev = self.oConfig.iStartRevision; # Construct a command line. os.environ['LC_ALL'] = 'en_US.utf-8'; asArgs = [ 'svn', 'log', '--xml', '--revision', str(iStartRev) + ':HEAD', ]; if self.oConfig.asExtraOptions is not None: asArgs.extend(self.oConfig.asExtraOptions); asArgs.append(self.oConfig.sUrl); if not self.oConfig.fQuiet: print('Executing: %s' % (asArgs,)); sLogXml = utils.processOutputChecked(asArgs); # Parse the XML and add the entries to the database. oParser = ET.XMLParser(target = ET.TreeBuilder(), encoding = 'utf-8'); oParser.feed(sLogXml.encode('utf-8')); # does its own decoding and processOutputChecked always gives us decoded utf-8 now. oRoot = oParser.close(); for oLogEntry in oRoot.findall('logentry'): iRevision = int(oLogEntry.get('revision')); sAuthor = oLogEntry.findtext('author').strip(); sDate = oLogEntry.findtext('date').strip(); sMessage = oLogEntry.findtext('msg', '').strip(); if sMessage == '': sMessage = ' '; elif len(sMessage) > VcsRevisionData.kcchMax_sMessage: sMessage = sMessage[:VcsRevisionData.kcchMax_sMessage - 4] + ' ...'; if not self.oConfig.fQuiet: utils.printOut(u'sDate=%s iRev=%u sAuthor=%s sMsg[%s]=%s' % (sDate, iRevision, sAuthor, type(sMessage).__name__, sMessage)); oData = VcsRevisionData().initFromValues(self.oConfig.sRepository, iRevision, sDate, sAuthor, sMessage); oLogic.addVcsRevision(oData); oDb.commit(); oDb.close(); return 0;
def main(self): """ Main function. """ oDb = TMDatabaseConnection() oLogic = VcsRevisionLogic(oDb) # Where to start. iStartRev = 0 if not self.oConfig.fFull: iStartRev = oLogic.getLastRevision(self.oConfig.sRepository) if iStartRev == 0: iStartRev = self.oConfig.iStartRevision # Construct a command line. os.environ["LC_ALL"] = "en_US.utf-8" asArgs = ["svn", "log", "--xml", "--revision", str(iStartRev) + ":HEAD"] if self.oConfig.asExtraOptions is not None: asArgs.extend(self.oConfig.asExtraOptions) asArgs.append(self.oConfig.sUrl) if not self.oConfig.fQuiet: print "Executing: %s" % (asArgs,) sLogXml = utils.processOutputChecked(asArgs) # Parse the XML and add the entries to the database. oParser = ET.XMLParser(target=ET.TreeBuilder(), encoding="utf-8") oParser.feed(sLogXml) oRoot = oParser.close() for oLogEntry in oRoot.findall("logentry"): iRevision = int(oLogEntry.get("revision")) sAuthor = oLogEntry.findtext("author").strip() sDate = oLogEntry.findtext("date").strip() sMessage = oLogEntry.findtext("msg", "").strip() if sMessage == "": sMessage = " " if not self.oConfig.fQuiet: print "sDate=%s iRev=%u sAuthor=%s sMsg[%s]=%s" % ( sDate, iRevision, sAuthor, type(sMessage).__name__, sMessage, ) oData = VcsRevisionData().initFromValues(self.oConfig.sRepository, iRevision, sDate, sAuthor, sMessage) oLogic.addVcsRevision(oData) oDb.commit() oDb.close() return 0
def main(self): """ Main function. """ oDb = TMDatabaseConnection(); oLogic = VcsRevisionLogic(oDb); # Where to start. iStartRev = 0; if not self.oConfig.fFull: iStartRev = oLogic.getLastRevision(self.oConfig.sRepository); if iStartRev == 0: iStartRev = self.oConfig.iStartRevision; # Construct a command line. os.environ['LC_ALL'] = 'en_US.utf-8'; asArgs = [ 'svn', 'log', '--xml', '--revision', str(iStartRev) + ':HEAD', ]; if self.oConfig.asExtraOptions is not None: asArgs.extend(self.oConfig.asExtraOptions); asArgs.append(self.oConfig.sUrl); if not self.oConfig.fQuiet: print 'Executing: %s' % (asArgs,); sLogXml = utils.processOutputChecked(asArgs); # Parse the XML and add the entries to the database. oParser = ET.XMLParser(target = ET.TreeBuilder(), encoding = 'utf-8'); oParser.feed(sLogXml); oRoot = oParser.close(); for oLogEntry in oRoot.findall('logentry'): iRevision = int(oLogEntry.get('revision')); sAuthor = oLogEntry.findtext('author').strip(); sDate = oLogEntry.findtext('date').strip(); sMessage = oLogEntry.findtext('msg', '').strip(); if sMessage == '': sMessage = ' '; if not self.oConfig.fQuiet: print 'sDate=%s iRev=%u sAuthor=%s sMsg[%s]=%s' % (sDate, iRevision, sAuthor, type(sMessage).__name__, sMessage); oData = VcsRevisionData().initFromValues(self.oConfig.sRepository, iRevision, sDate, sAuthor, sMessage); oLogic.addVcsRevision(oData); oDb.commit(); oDb.close(); return 0;
def main(self): """ Main function. """ oDb = TMDatabaseConnection(); oLogic = VcsRevisionLogic(oDb); oBugLogic = VcsBugReferenceLogic(oDb); # Where to start. iStartRev = 0; if not self.oConfig.fFull: if not self.oConfig.fBugRefsOnly: iStartRev = oLogic.getLastRevision(self.oConfig.sRepository); else: iStartRev = oBugLogic.getLastRevision(self.oConfig.sRepository); if iStartRev == 0: iStartRev = self.oConfig.iStartRevision; # Construct a command line. os.environ['LC_ALL'] = 'en_US.utf-8'; asArgs = [ 'svn', 'log', '--xml', '--revision', str(iStartRev) + ':HEAD', ]; if self.oConfig.asExtraOptions is not None: asArgs.extend(self.oConfig.asExtraOptions); asArgs.append(self.oConfig.sUrl); if not self.oConfig.fQuiet: print('Executing: %s' % (asArgs,)); sLogXml = utils.processOutputChecked(asArgs); # Parse the XML and add the entries to the database. oParser = ET.XMLParser(target = ET.TreeBuilder(), encoding = 'utf-8'); oParser.feed(sLogXml.encode('utf-8')); # Does its own decoding; processOutputChecked always gives us decoded utf-8 now. oRoot = oParser.close(); for oLogEntry in oRoot.findall('logentry'): iRevision = int(oLogEntry.get('revision')); sAuthor = oLogEntry.findtext('author', 'unspecified').strip(); # cvs2svn entries doesn't have an author. sDate = oLogEntry.findtext('date').strip(); sRawMsg = oLogEntry.findtext('msg', '').strip(); sMessage = sRawMsg; if sMessage == '': sMessage = ' '; elif len(sMessage) > VcsRevisionData.kcchMax_sMessage: sMessage = sMessage[:VcsRevisionData.kcchMax_sMessage - 4] + ' ...'; if not self.oConfig.fQuiet: utils.printOut(u'sDate=%s iRev=%u sAuthor=%s sMsg[%s]=%s' % (sDate, iRevision, sAuthor, type(sMessage).__name__, sMessage)); if not self.oConfig.fBugRefsOnly: oData = VcsRevisionData().initFromValues(self.oConfig.sRepository, iRevision, sDate, sAuthor, sMessage); oLogic.addVcsRevision(oData); # Analyze the raw message looking for bug tracker references. for oBugTracker in g_kdBugTrackers.values(): for sTag in oBugTracker.asCommitTags: off = sRawMsg.find(sTag); while off >= 0: off += len(sTag); while off < len(sRawMsg) and sRawMsg[off].isspace(): off += 1; if off < len(sRawMsg) and sRawMsg[off].isdigit(): offNum = off; while off < len(sRawMsg) and sRawMsg[off].isdigit(): off += 1; try: iBugNo = long(sRawMsg[offNum:off]); except Exception as oXcpt: utils.printErr(u'error! exception(r%s,"%s"): -> %s' % (iRevision, sRawMsg[offNum:off], oXcpt,)); else: if not self.oConfig.fQuiet: utils.printOut(u' r%u -> sBugTracker=%s iBugNo=%s' % (iRevision, oBugTracker.sDbId, iBugNo,)); oBugData = VcsBugReferenceData().initFromValues(self.oConfig.sRepository, iRevision, oBugTracker.sDbId, iBugNo); oBugLogic.addVcsBugReference(oBugData); # next off = sRawMsg.find(sTag, off); oDb.commit(); oDb.close(); return 0;