import imagepairset
import results
-ACTUALS_SVN_REPO = 'http://skia-autogen.googlecode.com/svn/gm-actual'
PATHSPLIT_RE = re.compile('/([^/]+)/(.+)')
EXPECTATIONS_DIR = os.path.join(TRUNK_DIRECTORY, 'expectations', 'gm')
GENERATED_IMAGES_ROOT = os.path.join(PARENT_DIRECTORY, 'static',
KEY__HEADER__TYPE = 'type'
DEFAULT_ACTUALS_DIR = '.gm-actuals'
+DEFAULT_ACTUALS_REPO_REVISION = 'HEAD'
+DEFAULT_ACTUALS_REPO_URL = 'http://skia-autogen.googlecode.com/svn/gm-actual'
DEFAULT_PORT = 8888
# How often (in seconds) clients should reload while waiting for initial
def __init__(self,
actuals_dir=DEFAULT_ACTUALS_DIR,
+ actuals_repo_revision=DEFAULT_ACTUALS_REPO_REVISION,
+ actuals_repo_url=DEFAULT_ACTUALS_REPO_URL,
port=DEFAULT_PORT, export=False, editable=True,
reload_seconds=0):
"""
Args:
actuals_dir: directory under which we will check out the latest actual
GM results
+ actuals_repo_revision: revision of actual-results.json files to process
+ actuals_repo_url: SVN repo to download actual-results.json files from
port: which TCP port to listen on for HTTP requests
export: whether to allow HTTP clients on other hosts to access this server
editable: whether HTTP clients are allowed to submit new baselines
if 0, don't check for new results at all
"""
self._actuals_dir = actuals_dir
+ self._actuals_repo_revision = actuals_repo_revision
+ self._actuals_repo_url = actuals_repo_url
self._port = port
self._export = export
self._editable = editable
self._reload_seconds = reload_seconds
self._actuals_repo = _create_svn_checkout(
- dir_path=actuals_dir, repo_url=ACTUALS_SVN_REPO)
+ dir_path=actuals_dir, repo_url=actuals_repo_url)
# Reentrant lock that must be held whenever updating EITHER of:
# 1. self._results
with self.results_rlock:
if invalidate:
self._results = None
- logging.info('Updating actual GM results in %s from SVN repo %s ...' % (
- self._actuals_dir, ACTUALS_SVN_REPO))
- self._actuals_repo.Update('.')
+ logging.info(
+ 'Updating actual GM results in %s to revision %s from repo %s ...' % (
+ self._actuals_dir, self._actuals_repo_revision,
+ self._actuals_repo_url))
+ self._actuals_repo.Update(path='.', revision=self._actuals_repo_revision)
# We only update the expectations dir if the server was run with a
# nonzero --reload argument; otherwise, we expect the user to maintain
KEY__HEADER: {
KEY__HEADER__IS_STILL_LOADING: True,
KEY__HEADER__TIME_UPDATED: now,
- KEY__HEADER__TIME_NEXT_UPDATE_AVAILABLE:
- now + RELOAD_INTERVAL_UNTIL_READY,
+ KEY__HEADER__TIME_NEXT_UPDATE_AVAILABLE: (
+ now + RELOAD_INTERVAL_UNTIL_READY),
},
}
self.send_json_dict(response_dict)
'actual GM results. If this directory does not '
'exist, it will be created. Defaults to %(default)s'),
default=DEFAULT_ACTUALS_DIR)
+ parser.add_argument('--actuals-repo',
+ help=('URL of SVN repo to download actual-results.json '
+ 'files from. Defaults to %(default)s'),
+ default=DEFAULT_ACTUALS_REPO_URL)
+ parser.add_argument('--actuals-revision',
+ help=('revision of actual-results.json files to process. '
+ 'Defaults to %(default)s . Beware of setting this '
+ 'argument in conjunction with --editable; you '
+ 'probably only want to edit results at HEAD.'),
+ default=DEFAULT_ACTUALS_REPO_REVISION)
parser.add_argument('--editable', action='store_true',
help=('Allow HTTP clients to submit new baselines.'))
parser.add_argument('--export', action='store_true',
args = parser.parse_args()
global _SERVER
_SERVER = Server(actuals_dir=args.actuals_dir,
+ actuals_repo_revision=args.actuals_revision,
+ actuals_repo_url=args.actuals_repo,
port=args.port, export=args.export, editable=args.editable,
reload_seconds=args.reload)
_SERVER.run()
"""
return self._RunCommand([SVN, 'checkout', url, path])
- def Update(self, path):
+ def Update(self, path, revision='HEAD'):
"""Update the working copy.
Returns stdout as a single string.
@param path path (within self._directory) within which to run
- "svn update"
+ "svn update"
+ @param revision revision to update to
"""
- return self._RunCommand([SVN, 'update', path])
+ return self._RunCommand([SVN, 'update', path, '--revision', revision])
def ListSubdirs(self, url):
"""Returns a list of all subdirectories (not files) within a given SVN