Пример #1
0
            last_num = 0
            for f in diff_files:
                number = os.path.splitext(os.path.basename(f))[0]
                number = int(number) if number.isdigit() else last_num
                last_num = max(last_num, number)

            with open(os.path.join(diff_dir_v2, "{}.diff".format(last_num + 1)), 'w') as f:
                f.write(json.dumps(summary))

            db_git.status = GitStatusChoice.NON_SYNCED
            db_git.save()

    except GitData.DoesNotExist:
        pass

def _ondump(tid, user, data_format, scheme, host, plugin_meta_data):
    db_task = Task.objects.get(pk = tid)
    try:
        db_git = GitData.objects.get(pk = db_task)
        plugin_meta_data['git'] = OrderedDict({
            "url": db_git.url,
            "path": db_git.path,
        })
    except GitData.DoesNotExist:
        pass

add_plugin("patch_job_data", _onsave, "after", exc_ok = False)

# TODO: Append git repository into dump file
# add_plugin("_dump", _ondump, "before", exc_ok = False)
Пример #2
0
                number = os.path.splitext(os.path.basename(f))[0]
                number = int(number) if number.isdigit() else last_num
                last_num = max(last_num, number)

            with open(os.path.join(diff_dir, "{}.diff".format(last_num + 1)),
                      'w') as f:
                f.write(json.dumps(diff))

            db_git.status = GitStatusChoice.NON_SYNCED
            db_git.save()

    except GitData.DoesNotExist:
        pass


def _ondump(tid, data_format, scheme, host, plugin_meta_data):
    db_task = Task.objects.get(pk=tid)
    try:
        db_git = GitData.objects.get(pk=db_task)
        plugin_meta_data['git'] = OrderedDict({
            "url": db_git.url,
            "path": db_git.path,
        })
    except GitData.DoesNotExist:
        pass


add_plugin("save_job", _onsave, "after", exc_ok=False)
add_plugin("_create_thread", _initial_create, "before", exc_ok=False)
add_plugin("_dump", _ondump, "before", exc_ok=False)