Skip to content

Commit

Permalink
feat: Add "pdm-sync" pre-commit hook (#2475)
Browse files Browse the repository at this point in the history
  • Loading branch information
p-rogalski authored Dec 8, 2023
1 parent 47e8c69 commit b05d1cb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,15 @@
language: python
language_version: python3
pass_filenames: false
files: ^pdm.lock$
files: ^pdm.lock$
- id: pdm-sync
name: pdm-sync
description: sync current working set with pdm.lock
entry: pdm sync
language: python
language_version: python3
pass_filenames: false
stages:
- post-checkout
- post-merge
always_run: true
11 changes: 11 additions & 0 deletions docs/docs/usage/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,14 @@ This hook wraps the command `pdm lock --check` along with any valid argument. It
hooks:
- id: pdm-lock-check
```

### Sync current working set with `pdm.lock`

This hook wraps the command `pdm sync` along with any valid argument. It can be used as a hook to ensure that your current working set is synced with `pdm.lock` whenever you checkout or merge a branch.

```yaml
- repo: https://github.com/pdm-project/pdm
rev: 2.x.y # a PDM release exposing the hook
hooks:
- id: pdm-sync
```
1 change: 1 addition & 0 deletions news/2474.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add "pdm sync" pre-commit hook

0 comments on commit b05d1cb

Please sign in to comment.