Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 12511 → Rev 12512

/tools/mrscribe/Svnwatch/plugin.py
35,17 → 35,18
def __init__(self, irc):
self.__parent = super(Svnwatch, self)
self.__parent.__init__(irc)
try:
self.xmluri = self.registryValue('xmluri')
self.wait = self.registryValue('fetchPeriod')
self.postfrequency = self.registryValue('postFrequency')
self.channels = self.registryValue('channels')
self.lastrev = self.registryValue('lastRevision')
self.lastfetch = time.time() - self.wait - 1
self.log.debug("%s; %s, %s, %s, %s" % (self.xmluri, self.wait, self.postfrequency, self.channels, self.lastrev))
except registry.NonExistentRegistryEntry:
self.log.debug('%s is not a registered URI.', self.xmluri)
irc.error('Can\'t get configuration variables.', Raise=True)
# try:
self.xmluri = self.registryValue('xmluri')
self.wait = self.registryValue('fetchPeriod')
self.postfrequency = self.registryValue('postFrequency')
# self.batchsize = self.registryValue('batchSize')
self.channels = self.registryValue('channels')
self.lastrev = self.registryValue('lastRevision')
self.lastfetch = time.time() - self.wait - 1
self.log.debug("%s; %s, %s, %s, %s" % (self.xmluri, self.wait, self.postfrequency, self.channels, self.lastrev))
# except registry.NonExistentRegistryEntry:
# self.log.debug('%s is not a registered URI.', self.xmluri)
# irc.error('Can\'t get configuration variables.', Raise=True)
self.getCommit(irc)
 
def canGetNewCommit(self, irc):
74,6 → 75,9
else:
return self.commitdata.keys()[0]
 
def printData(self, irc, data, channel):
irc.reply(data, to=channel, prefixNick=False, private=True)
 
def getCommit(self, irc):
self.channels = self.registryValue('channels')
self.log.debug("Reporting channels: %s", self.channels)
92,7 → 96,7
self.log.debug("Fetched 'HEAD' - no new commmits at %s", self.xmluri)
self.now = time.time()
self.lastfetch = self.now
self.log.debug("Fetched new 'HEAD' revision at %s" % (self.now))
# self.log.debug("Fetched new 'HEAD' revision at %s" % (self.now))
else:
self.oldestnewrev = self.lastrev + 1
self.revid = "%s:HEAD" % self.oldestnewrev
103,21 → 107,39
self.resultcommitdata = svnxmlparser.getCommit(self.rawxml)
self.log.debug("Fetched data %s" % self.resultcommitdata)
self.shortdata = svnxmlparser.shortoutput(self.resultcommitdata)
self.log.debug("Short data: %s" % self.shortdata)
if len(self.shortdata) == 1:
self.revisiondata = " ".join(self.shortdata)
self.log.debug("Formatted data: %s" % self.revisiondata)
self.lastrev = int(self.revisiondata.split(" ")[1])
self.log.debug("Revision ID: %s" % self.lastrev)
for self.channel in self.channels:
irc.replies(self.revisiondata, joiner='', to=self.channel, prefixNick=False, private=True)
else:
for self.revisiondata in self.shortdata:
self.log.debug("Revision data: %s" % self.revisiondata)
self.lastrev = int(self.revisiondata.split(" ")[1])
self.log.debug("Last revision ID: %s" % self.lastrev)
for self.channel in self.channels:
irc.replies(self.revisiondata, joiner='', to=self.channel, prefixNick=False, private=True)
self.log.debug("Data list: %s" % self.shortdata)
batch = self.shortdata[:5]
# self.lastrev = self.batch[-1]
self.log.debug("Revision #: %s" % self.lastrev)
for revisiondata in batch:
self.log.debug("Revision data: %s" % revisiondata)
self.lastrev = int(revisiondata.split(" ")[1])
self.log.debug("Processed revision #%s" % self.lastrev)
self.log.debug("Revision data: %s" % revisiondata)
for channel in self.channels:
self.printData(irc, revisiondata, channel)
# irc.replies(self.revisiondata, joiner='', to=self.channel, prefixNick=False, private=True)
# irc.reply(self.revisiondata, to=self.channel, prefixNick=False, private=True)
# if len(self.shortdata) == 1:
# self.revisiondata = " ".join(self.shortdata)
# self.log.debug("Formatted data: %s" % self.revisiondata)
# self.lastrev = int(self.revisiondata.split(" ")[1])
# self.log.debug("Revision ID: %s" % self.lastrev)
# for self.channel in self.channels:
# irc.reply(self.revisiondata, joiner='', to=self.channel, prefixNick=False, private=True)
# else:
# self.log.debug("Multiple data sets detected")
# for self.revisiondata in self.shortdata:
# self.log.debug("Revision data: %s" % self.revisiondata)
# self.lastrev = int(self.revisiondata.split(" ")[1])
# self.log.debug("Last revision ID: %s" % self.lastrev)
# for self.channel in self.channels:
# self.log.debug("Sleeping in channels for %i sec." % self.postfrequency)
# self.log.debug("Revision data: %s" % self.revisiondata)
# irc.replies(self.revisiondata, joiner='', to=self.channel, prefixNick=False, private=True)
# irc.reply(self.revisiondata, to=self.channel, prefixNick=False, private=True)
# self.log.debug("Sleeping in data cycles for %i sec." % self.postfrequency) (self.postfrequency)
# sleep(self.postfrequency)
self.now = time.time()
self.lastfetch = self.now
conf.supybot.plugins.Svnwatch.lastRevision.setValue(self.lastrev)