From 7d79ad8d3e443fe42d3049db067b4ccfd96552d2 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 19 Dec 2019 15:25:23 +0100 Subject: [PATCH] [FIX] forwardport: don't keep the commit date This is not super useful and causes issues with runbot as it uses commit dates to decide how "old" branches are, and ignores (doesn't create when it scans them) branches more than a month old. So the forwardport branches will be completely ignored (not considered let alone tested) if we happen to forward-port a PR last updated more than a month ago. Which is somewhat inconvenient. Closes #274 --- forwardport/models/project.py | 2 +- forwardport/tests/test_simple.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/forwardport/models/project.py b/forwardport/models/project.py index 18d62207..46c7c0fc 100644 --- a/forwardport/models/project.py +++ b/forwardport/models/project.py @@ -702,6 +702,7 @@ More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port conf = working_copy.with_config(env={ **to_dict('AUTHOR', author), **to_dict('COMMITTER', committer), + 'GIT_COMMITTER_DATE': '', }) # squash to a single commit conf.reset('--soft', root_commits[0]['parents'][0]['sha']) @@ -759,7 +760,6 @@ stderr: 'GIT_AUTHOR_DATE': cm['author']['date'], 'GIT_COMMITTER_NAME': cm['committer']['name'], 'GIT_COMMITTER_EMAIL': cm['committer']['email'], - 'GIT_COMMITTER_DATE': cm['committer']['date'], }) conf = configured.with_config(stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False) diff --git a/forwardport/tests/test_simple.py b/forwardport/tests/test_simple.py index fbc4fc81..f5e6de14 100644 --- a/forwardport/tests/test_simple.py +++ b/forwardport/tests/test_simple.py @@ -389,7 +389,9 @@ def test_conflict(env, config, make_repo): p = prod.commit(p_0) c = prod.commit(pr1.head) assert c.author == p.author - assert c.committer == p.committer + # ignore date as we're specifically not keeping the original's + without_date = itemgetter('name', 'email') + assert without_date(c.committer) == without_date(p.committer) assert prod.read_tree(c) == { 'f': 'c', 'g': re_matches(r'''<<<\x3c<<< HEAD