Skip to content

Commit

Permalink
feat: delete old assignments and add fetch script
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobrobertsbaca committed Jan 8, 2025
1 parent 379d76b commit de5e072
Show file tree
Hide file tree
Showing 68 changed files with 38 additions and 7,242 deletions.
38 changes: 38 additions & 0 deletions admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import subprocess
import shutil
import os
import argparse


def find_last_commit_with_path(path):
try:
commit_hash = subprocess.check_output(
["git", "log", "-n", "1", "--pretty=format:%H", "--", path],
stderr=subprocess.DEVNULL
).decode("utf-8").strip()
return commit_hash
except subprocess.CalledProcessError:
return None

def copy_from_commit(commit_hash, path):
os.makedirs(path, exist_ok=True)
subprocess.run(["git", "checkout", commit_hash, "--", path])
shutil.copytree(path, path, dirs_exist_ok=True)


def main():
parser = argparse.ArgumentParser(description="Copies an old assignment into the worktree.")
parser.add_argument("assignment", help="An assignment, e.g. 'assign0', 'assign1', etc.")
args = parser.parse_args()

path = args.assignment
commit_hash = find_last_commit_with_path(path)

if commit_hash:
print(f"Last commit for {path}: {commit_hash}")
copy_from_commit(commit_hash, path)
print(f"Copied {path} from commit {commit_hash}.")
else:
print(f"No commits found for the specified assignment: {path}.")

main()
114 changes: 0 additions & 114 deletions assign1/README.md

This file was deleted.

97 changes: 0 additions & 97 deletions assign1/autograder/autograder.py

This file was deleted.

Binary file removed assign1/autograder/courses_not_offered.bin
Binary file not shown.
Binary file removed assign1/autograder/courses_offered.bin
Binary file not shown.
1 change: 0 additions & 1 deletion assign1/autograder/requirements.txt

This file was deleted.

96 changes: 0 additions & 96 deletions assign1/autograder/utils.py

This file was deleted.

Loading

0 comments on commit de5e072

Please sign in to comment.