summaryrefslogtreecommitdiffstats
path: root/hooks.py
diff options
context:
space:
mode:
authorRam Peri <ramperi@google.com>2026-04-21 00:02:47 +0000
committergerrit-scoped@luci-project-accounts.iam.gserviceaccount.com <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2026-04-21 17:10:07 -0700
commit5af71ce907848a546199f0d64a5dfba1db8adca0 (patch)
tree511327039aeb7db3d08a1fdc6bdb7b537116d63d /hooks.py
parentbaa281d99e59dbf1447524e6fd95b384cadbc06e (diff)
downloadgit-repo-5af71ce907848a546199f0d64a5dfba1db8adca0.tar.gz
Add timing keyword argument for hooks
Measure the duration of the sync operation in the Execute method of the Sync command and pass it to post-sync hooks as a standard keyword argument (`sync_duration_seconds`). Updates based on code review: - Update _API_ARGS in hooks.py to allow sync_duration_seconds for post-sync hooks. - Do not cast sync_duration_seconds to int for better granularity. - Update docs/repo-hooks.md to document sync_duration_seconds. - Add unit test for argument validation in test_hooks.py. Test: Ran run_tests using venv python, all 554 tests passed. Bug: TBD Change-Id: Ie29e002a5d283460d993ad96c224dbf4b6d7985c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/575021 Tested-by: Arif Kasim <arifkasim@google.com> Commit-Queue: Ram Peri <ramperi@google.com> Reviewed-by: Arif Kasim <arifkasim@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
Diffstat (limited to 'hooks.py')
-rw-r--r--hooks.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/hooks.py b/hooks.py
index d6e1e3bbc..0637dcec8 100644
--- a/hooks.py
+++ b/hooks.py
@@ -25,7 +25,7 @@ from git_refs import HEAD
25# The API we've documented to hook authors. Keep in sync with repo-hooks.md. 25# The API we've documented to hook authors. Keep in sync with repo-hooks.md.
26_API_ARGS = { 26_API_ARGS = {
27 "pre-upload": {"project_list", "worktree_list"}, 27 "pre-upload": {"project_list", "worktree_list"},
28 "post-sync": {"repo_topdir"}, 28 "post-sync": {"repo_topdir", "sync_duration_seconds"},
29} 29}
30 30
31 31