From 172f1ee603bb0bf287d2535ab7e038a0b1d78326 Mon Sep 17 00:00:00 2001 From: Martin Taibr Date: Sat, 23 Sep 2017 02:35:21 +0200 Subject: [PATCH] ignore branches not updated in 2 years --- qcsrc/tools/uncrustify-unmodified.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qcsrc/tools/uncrustify-unmodified.py b/qcsrc/tools/uncrustify-unmodified.py index 83b5d0987..c9c558428 100755 --- a/qcsrc/tools/uncrustify-unmodified.py +++ b/qcsrc/tools/uncrustify-unmodified.py @@ -6,6 +6,8 @@ # If you're on Windows, you probably wanna fix path separators and maybe other tihngs, I am not touching that. +from datetime import datetime, timedelta, timezone +from dateutil import parser import glob import os.path import shlex @@ -35,8 +37,13 @@ def main(): print(branch) # getting this info is a bit slow - last_change = run(r'git show --pretty=format:"%ci" {}'.format(branch))[0] - print("\t last change:", last_change) + last_change_str = run(r'git show --pretty=format:"%ci" {}'.format(branch))[0] + print("\t last change:", last_change_str) + + last_change = parser.parse(last_change_str) + if datetime.now(timezone.utc) - last_change > timedelta(days=365*2): # who cares about leap years + print("\t ignoring") + continue # If some complex branching and merging happens, there can be multiple merge bases. # The diff between each of them and the tip of the branch can contain changes that are not in master -- 2.39.2