blender/release/scripts/io/netrender/versioning.py
Martin Poirier 58a1ddcc9e netrender
New Feature:
VCS job type
	Render a file (with dependencies) from a version control system (currently only supports subversion, but system is already generic).
	On client, working path, server path and current revision can be guessed from data on disk or entered manually.
	On slave, a working copy is created (if needed) where specified by the job and updated to the proper revision.
	On master web page, job types now appear in the job lists. The job page shows the list of dependencies for "normal" jobs or versioning information for VCS jobs.

	Limitations: Need to have command line tools "svn" and "svnversion". Working copy path must be the same on client and slaves (the client gets the job path relative to the working copy). When guessing, working copy path is set to the folder where the current file is (this can be changed manually after). On the slave, it will update the working copy AS SPECIFIED to the revision, so if that path is too deep, some dependencies will not be updated properly. Doesn't support mixed revisions (and will not give any warnings for that), it will always use the first revision specified by "svnversion"

Bugfix:
Thumbnail generation doesn't chew down memory anymore and always gives correct result (thumbnail on master especially could mess up between jobs with the name result filename)
2010-10-27 18:24:58 +00:00

73 lines
2.1 KiB
Python

import sys, os
import re
import subprocess
from netrender.utils import *
class AbstractVCS:
name = "ABSTRACT VCS"
def __init__(self):
pass
def update(self, info):
"""update(info)
Update a working copy to the specified revision.
If working copy doesn't exist, do a full get from server to create it.
[info] model.VersioningInfo instance, specifies the working path, remote path and version number."""
pass
def revision(self, path):
"""revision(path)
return the current revision of the specified working copy path"""
pass
def path(self, path):
"""path(path)
return the remote path of the specified working copy path"""
pass
class Subversion(AbstractVCS):
name = "Subversion"
def __init__(self):
super().__init__()
self.version_exp = re.compile("([0-9]*)")
self.path_exp = re.compile("URL: (.*)")
def update(self, info):
if not os.path.exists(info.wpath):
base, folder = os.path.split(info.wpath)
with DirectoryContext(base):
subprocess.call(["svn", "co", "%s@%s" % (info.rpath, str(info.revision)), folder])
else:
with DirectoryContext(info.wpath):
subprocess.call(["svn", "up", "--accept", "theirs-full", "-r", str(info.revision)])
def revision(self, path):
if not os.path.exists(path):
return
with DirectoryContext(path):
stdout = subprocess.check_output(["svnversion"])
match = self.version_exp.match(str(stdout, encoding="utf-8"))
if match:
return match.group(1)
def path(self, path):
if not os.path.exists(path):
return
with DirectoryContext(path):
stdout = subprocess.check_output(["svn", "info"])
match = self.path_exp.search(str(stdout, encoding="utf-8"))
if match:
return match.group(1)
SYSTEMS = {
Subversion.name: Subversion()
}