Skip to content

Commit

Permalink
Add since and until arguments to the pick command
Browse files Browse the repository at this point in the history
  • Loading branch information
Dana Räder committed Dec 18, 2024
1 parent bfd039b commit f2c1747
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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
Expand Down
22 changes: 19 additions & 3 deletions perfact/zodbsync/commands/pick.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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:
Expand Down

0 comments on commit f2c1747

Please sign in to comment.