Git has a switch to generate patches for a given revision. This generates a better filename, and still generate a Subject that is functionally similar to the one before.
So for this patch we would have: - "v2-0003-replicant_prepare_patch.py-Handle-serie-revision-.patch" for the file name - "Subject: [vendor_replicant-scripts] [PATCH v2 3/3] replicant_prepare_patch.py: Handle serie revision with git's -v switch" for the Subject Signed-off-by: Denis 'GNUtoo' Carikli <[email protected]> --- patches/replicant_prepare_patch.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/patches/replicant_prepare_patch.py b/patches/replicant_prepare_patch.py index 5fd02c3..209c81d 100755 --- a/patches/replicant_prepare_patch.py +++ b/patches/replicant_prepare_patch.py @@ -107,9 +107,10 @@ def get_repo_name(config): # We want to generate a prefix to have the project name in it. # Examples: -# - [libsamsung-ipc][PATCH v2] Fix IPC_SEC_LOCK_INFOMATION typo +# - [libsamsung-ipc][PATCH] Fix IPC_SEC_LOCK_INFOMATION typo # - [device_samsung_i9300][PATCH] Add scripts to disable the modem -def get_subject_prefix(config, revision): +# The revision is handled separately with git format-patch's -v<num> switch +def get_subject_prefix(config): repo_name = get_repo_name(config) # Try to autodetect the project name: @@ -130,21 +131,19 @@ def get_subject_prefix(config, revision): if project_name == None: return None - if revision == None: - return '{project}] [PATCH'.format(project=project_name) - else: - return '{project}] [PATCH {rev}]['.format(project=project_name, - rev=revision) - + return '{project}] [PATCH'.format(project=project_name) def generate_patches(config, git_revision, nr_patches, patches_revision): - subject_prefix = get_subject_prefix(config, patches_revision) + subject_prefix = get_subject_prefix(config) git_arguments = ['format-patch', git_revision, '-{}'.format(nr_patches)] if subject_prefix != None: git_arguments.append('--subject-prefix={}'.format(subject_prefix)) + if patches_revision != None: + git_arguments.append('-v{}'.format(patches_revision)) + patches = git(*git_arguments).split(os.linesep) patches.remove('') @@ -207,7 +206,7 @@ if __name__ == '__main__': nr_patches = int(sys.argv[2]) if len (sys.argv) >= 4: - patches_revision = sys.argv[3] + patches_revision = int(sys.argv[3]) config = get_config() -- 2.28.0 _______________________________________________ Replicant mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/replicant
