From f2c1747e8014c03ab0adff69f000c2c59ef35271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dana=20R=C3=A4der?= Date: Wed, 18 Dec 2024 12:11:40 +0100 Subject: [PATCH] Add `since` and `until` arguments to the `pick` command --- CHANGELOG | 1 + perfact/zodbsync/commands/pick.py | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2ed78cd..291e59b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ 23.2.1.dev0 * Only try to playback differing paths below __root__ + * Add `since` and `until` arguments to the `pick` command 23.2.0 * Fixed a bug where zodbsync was writing `source`-files into frozen diff --git a/perfact/zodbsync/commands/pick.py b/perfact/zodbsync/commands/pick.py index beb9b24..5534cfd 100644 --- a/perfact/zodbsync/commands/pick.py +++ b/perfact/zodbsync/commands/pick.py @@ -20,6 +20,14 @@ def add_args(parser): ones, limiting to those with commit messages matching the pattern - like "git log --grep".""", ) + parser.add_argument( + '--since', type=str, help="""Find commits since the given timestamp + - like "git log --since".""", + ) + parser.add_argument( + '--until', type=str, help="""Find commits until the given timestamp + - like "git log --until".""", + ) parser.add_argument( 'commit', type=str, nargs='*', help='''Commits that are checked for compatibility and applied, @@ -29,10 +37,18 @@ def add_args(parser): @SubCommand.gitexec def run(self): commits = [] - if self.args.grep: + if self.args.grep or self.args.after or self.args.before: + cmd = [ + 'log', '--format=%H', '--reverse' + ] + if self.args.grep: + cmd.extend(['--grep', self.args.grep]) + if self.args.since: + cmd.extend(['--since', self.args.since]) + if self.args.until: + cmd.extend(['--until', self.args.until]) commits = self.gitcmd_output( - 'log', '--grep', self.args.grep, - '--format=%H', '--reverse', *self.args.commit + *cmd, *self.args.commit ).split('\n') else: for commit in self.args.commit: