def status(self):
        docs = {'updated'  : [],
                'committed': [],
                'to_commit': []}

        row = self.db.internal.find_one({'_id': 'last_sync'})

        if row and 'update' in row:
            for id in row['update']:
                docs['updated'].append(self.get(id, deleted=True))

        if row and 'commit' in row:
            for id in row['commit']:
                docs['committed'].append(self.get(id, deleted=True))

        to_commit =  self.get_docs_to_commit()
        for row in to_commit:
            doc = Document(**row)
            docs['to_commit'].append(doc)
        return docs
def commit_and_push(repo_dir, day):
    subprocess.check_call(
        ["git", "config", "--global", "user.email", "u1test+m-o@canonical.com"]
    )
    subprocess.check_call(["git", "config", "--global", "user.name", "snappy-m-o"])

    subprocess.check_call(["git", "-C", repo_dir, "add", "--all"])
    subprocess.check_call(
        [
            "git",
            "-C",
            repo_dir,
            "commit",
            "--message",
            "Add the results for {}".format(day),
        ]
    )

    subprocess.check_call(
        [
            "git",
            "-C",
            repo_dir,
            "push",
            "https://{GH_TOKEN}@github.com/elopio/autopkgtest-results.git".format(
                GH_TOKEN=os.environ.get("GH_TOKEN_PPA_AUTOPKGTEST_RESULTS")
            ),
        ]
    )