From 48f339194c69d8d62736fbb3d1f54316a4b2f9ff Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Mon, 18 Nov 2024 10:41:40 -0600 Subject: [PATCH] chore: remove unused merge-person-records (#8227) --- ietf/bin/merge-person-records | 65 ----------------------------------- 1 file changed, 65 deletions(-) delete mode 100755 ietf/bin/merge-person-records diff --git a/ietf/bin/merge-person-records b/ietf/bin/merge-person-records deleted file mode 100755 index 155e5755f..000000000 --- a/ietf/bin/merge-person-records +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -*- Python -*- -# -''' -This script merges two Person records into one. It determines which record is the target -based on most current User record (last_login) unless -f (force) option is used to -force SOURCE TARGET as specified on the command line. The order of operations is -important. We must complete all source.save() operations before moving the aliases to -the target, this is to avoid extra "Possible duplicate Person" emails going out, if the -Person is saved without an alias the Person.save() creates another one, which then -conflicts with the moved one. -''' - -# Set PYTHONPATH and load environment variables for standalone script ----------------- -import os, sys -basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")) -sys.path = [ basedir ] + sys.path -os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings" - -virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py") -if os.path.exists(virtualenv_activation): - execfile(virtualenv_activation, dict(__file__=virtualenv_activation)) - -import django -django.setup() -# ------------------------------------------------------------------------------------- - -import argparse -from django.contrib import admin -from ietf.person.models import Person -from ietf.person.utils import (merge_persons, send_merge_notification, handle_users, - determine_merge_order) - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("source_id",type=int) - parser.add_argument("target_id",type=int) - parser.add_argument('-f','--force', help='force merge order',action='store_true') - parser.add_argument('-v','--verbose', help='verbose output',action='store_true') - args = parser.parse_args() - - source = Person.objects.get(pk=args.source_id) - target = Person.objects.get(pk=args.target_id) - - # set merge order - if not args.force: - source,target = determine_merge_order(source,target) - - # confirm - print "Merging person {}({}) to {}({})".format(source.ascii,source.pk,target.ascii,target.pk) - print handle_users(source,target,check_only=True) - response = raw_input('Ok to continue y/n? ') - if response.lower() != 'y': - sys.exit() - - # perform merge - success, changes = merge_persons(source, target, verbose=args.verbose) - - # send email notification - send_merge_notification(target,changes) - -if __name__ == "__main__": - main()