Commits

Braden Obrzut committed cf3bc25

- Skulltag Plugin now supports new Mercurial revision format when performing auto downloads.

  • Participants
  • Parent commits 1b3672c

Comments (0)

Files changed (3)

File src/plugins/skulltag/skulltagbinaries.cpp

 //------------------------------------------------------------------------------
 // Copyright (C) 2010 "Zalewa" <zalewapl@gmail.com>
 //------------------------------------------------------------------------------
+#include "log.h"
 #include "skulltagbinaries.h"
 #include "skulltagengineplugin.h"
 #include "skulltagserver.h"
 #else
 	// Download testing binaries
 	SkulltagVersion version(server->version());
-	QUrl url(QString(TESTING_BINARY_URL).arg(QString("%1%2").arg(version.minorVersion()).arg(QChar(version.revisionLetter()))).arg(version.svnVersion()));
+
+	// Find the hg revision string
+	QString hgVersion;
+	if(version.hgVersionDate() < 4000) // Arbitrary number here to determine between old and new format
+		hgVersion = QString("%1").arg(version.hgVersionDate());
+	else
+		hgVersion = QString("%1-%2").arg(version.hgVersionDate()).arg(version.hgVersionTime(), 4, 10, QChar('0'));
+
+	// Get URL
+	QUrl url(QString(TESTING_BINARY_URL).arg(QString("%1%2").arg(version.minorVersion()).arg(QChar(version.revisionLetter()))).arg(hgVersion));
 
 	TestingProgressDialog dialog(url);
 	if(dialog.exec() == QDialog::Accepted)
 
 	if (fi.exists())
 	{
-		printf("File Permissions: %X\n", (unsigned int)file.permissions());
+		gLog << tr("File Permissions: %1").arg((unsigned int)file.permissions(), 0, 16);
 		if ((file.permissions() & QFile::ExeUser) == 0)
 		{
 			QString error = tr("You don't have permissions to execute file: %1\n").arg(fullPathToFile);

File src/plugins/skulltag/skulltagserver.cpp

 	revision = parts[3][0].toAscii();
 	build = parts[4].toUShort();
 	tag = parts[5];
-	svnRevision = parts[6].toUShort();
+	hgRevisionDate = parts[6].toUInt();
+	hgRevisionTime = parts[7].toUShort();
 }
 
 bool SkulltagVersion::operator> (const SkulltagVersion &other) const
 		return true;
 	if((tag.isEmpty() && !other.tag.isEmpty()) || (tag > other.tag))
 		return true;
-	if(svnRevision > other.svnRevision)
+	if(hgRevisionDate > other.hgRevisionDate)
+		return true;
+	if(hgRevisionTime > other.hgRevisionTime)
 		return true;
 	return false;
 }
 
-const QRegExp SkulltagVersion::versionExpression("(\\d+).(\\d+)([a-zA-Z])(\\d*)(?:-([a-zA-Z]*)?)(?:-r(\\d+)?)");
+const QRegExp SkulltagVersion::versionExpression("(\\d+).(\\d+)([a-zA-Z])(\\d*)(?:-([a-zA-Z]*)?)(?:-r(\\d+)(?:-(\\d+))?)");
 
 ////////////////////////////////////////////////////////////////////////////////
 

File src/plugins/skulltag/skulltagserver.h

 		unsigned short int	majorVersion() const { return major; }
 		unsigned short int	minorVersion() const { return minor; }
 		unsigned char		revisionLetter() const { return revision; }
-		unsigned short int	svnVersion() const { return svnRevision; }
+		unsigned int		hgVersionDate() const { return hgRevisionDate; }
+		unsigned short int	hgVersionTime() const { return hgRevisionTime; }
 
 		bool operator> (const SkulltagVersion &other) const;
 
 		unsigned char			revision;
 		unsigned short int		build;
 		QString					tag;
-		unsigned short int		svnRevision;
+		unsigned int			hgRevisionDate;
+		unsigned short int		hgRevisionTime;
 };
 
 class TeamInfo