#!/usr/bin/env python

print "This script tests all files that have changed in the repository"
print "that have not yet been commited using 'sage -hg commit'."

import os

v = os.popen('sage -hg status').read()
print v
F = []
for X in v.split('\n'):
    try:
        c, filename = X.split()
    except:
        break
    if c == 'M':
        F.append(filename)

if len(F) == 0:
    print "No files to test."
else:
    cmd = 'sage -t %s'%(' '.join([str(x) for x in F]))
    print cmd
    os.system(cmd)

