Assumes that some other code flow will have already generated a unique enough id, and will insert the change Id above the first discovered tag if one exists. Uses the splitting function recently introduced to perform that task.
Signed-off-by: Jacob Keller <[email protected]> --- stgit/utils.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/stgit/utils.py b/stgit/utils.py index 225aa3b2d014..0449bcaec34e 100644 --- a/stgit/utils.py +++ b/stgit/utils.py @@ -274,6 +274,23 @@ def split_desc_and_tags(desc): return re.split(regex, desc, maxsplit=1) +def add_changeid_line(desc, unique_hash): + # Hard code "Change-Id" for now + any_id_str = '\nChange-Id:' + change_id_str = 'Change-Id: %s' % (unique_hash) + + if any_id_str in desc: + return desc + + desc = desc.rstrip() + split = split_desc_and_tags(desc) + + # Put Change-Id above the current tags + if len(split) == 1: + return '%s\n\n%s\n' % (desc, change_id_str) + else: + return '%s\n%s%s\n' % (split[0], change_id_str, ''.join(split[1:])) + def add_sign_line(desc, sign_str, name, email): if not sign_str: return desc -- 2.6.1.264.gbab76a9 _______________________________________________ stgit-users mailing list [email protected] https://mail.gna.org/listinfo/stgit-users
