~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to bin/ivle-fetchsubmissions

ivle-fetchsubmissions: Now gets the URL including the path within the
repository (so it would check out only the submitted directory, not the entire
thing).

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
 
59
59
def get_repo_url(submission, config):
60
60
    """Gets a local (file:) URL to the repository for a given submission.
 
61
    This will consult submission.path to find the path within the repository
 
62
    to check out.
61
63
    @param submission: Submission object, detailing the submission.
62
64
    @param config: Config object.
63
65
    """
78
80
        repo_path = os.path.join(config['paths']['svn']['repo_path'],
79
81
                                'users', username)
80
82
 
 
83
    path_in_repo = submission.path
 
84
    # Change an absolute path into a relative one (to the top of SVN)
 
85
    if path_in_repo[:1] == os.sep or path_in_repo[:1] == os.altsep:
 
86
        path_in_repo = path_in_repo[1:]
 
87
 
81
88
    # Attach "file://" to the front of the absolute path, to make it a URL
82
 
    return "file://" + os.path.abspath(repo_path)
 
89
    return "file://" + os.path.join(os.path.abspath(repo_path), path_in_repo)
83
90
 
84
91
def main(argv=None):
85
92
    global store