Skip to content

Commit d66b826

Browse files
Merge branch 'main' into leander-dsouza/fix-svn-test
2 parents e47aac4 + 4d30d4b commit d66b826

File tree

8 files changed

+79
-39
lines changed

8 files changed

+79
-39
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
version: 2
23
updates:
34
- package-ecosystem: "github-actions"

.github/workflows/ci.yml

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: vcs2l
23

34
on:
@@ -13,39 +14,48 @@ jobs:
1314
runs-on: ${{ matrix.os }}
1415
strategy:
1516
matrix:
16-
os: [macos-latest, ubuntu-22.04, ubuntu-24.04, windows-2022, windows-2025]
17+
os:
18+
- macos-latest
19+
- ubuntu-22.04
20+
- ubuntu-24.04
21+
- windows-2022
22+
- windows-2025
1723
python-version: ["3.10", "3.12"]
24+
include:
25+
- os: ubuntu-22.04
26+
python-version: "3.7"
27+
- os: ubuntu-22.04
28+
python-version: "3.8"
1829

1930
steps:
20-
21-
- name: Checkout repository
22-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
23-
24-
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
26-
with:
27-
python-version: ${{ matrix.python-version }}
28-
29-
- name: Install dependencies
30-
run: |
31-
python -m pip install --upgrade pip setuptools wheel
32-
python -m pip install --upgrade PyYAML
33-
34-
- name: Install dependencies (macOS)
35-
run: |
36-
brew install subversion mercurial
37-
if: matrix.os == 'macos-latest'
38-
39-
- name: Install dependencies (Ubuntu)
40-
run: |
41-
sudo apt-get update
42-
sudo apt-get install -y subversion mercurial
43-
if: startsWith(matrix.os, 'ubuntu')
44-
45-
- name: Test with pytest
46-
run: |
47-
pip install --upgrade .[test]
48-
pip install --upgrade coverage
49-
git config --global --add init.defaultBranch main
50-
git config --global --add advice.detachedHead true
51-
${{ startsWith(matrix.os, 'windows') && 'set PYTHONPATH=%cd% &&' || 'PYTHONPATH=`pwd`' }} pytest -s -v test
31+
- name: Checkout repository
32+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
33+
34+
- name: Set up Python ${{ matrix.python-version }}
35+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
36+
with:
37+
python-version: ${{ matrix.python-version }}
38+
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install --upgrade pip setuptools wheel
42+
python -m pip install --upgrade PyYAML
43+
44+
- name: Install dependencies (macOS)
45+
run: |
46+
brew install subversion mercurial
47+
if: matrix.os == 'macos-latest'
48+
49+
- name: Install dependencies (Ubuntu)
50+
run: |
51+
sudo apt-get update
52+
sudo apt-get install -y subversion mercurial
53+
if: startsWith(matrix.os, 'ubuntu')
54+
55+
- name: Test with pytest
56+
run: |
57+
pip install --upgrade .[test]
58+
pip install --upgrade coverage
59+
git config --global --add init.defaultBranch main
60+
git config --global --add advice.detachedHead true
61+
${{ startsWith(matrix.os, 'windows') && 'set PYTHONPATH=%cd% &&' || 'PYTHONPATH=`pwd`' }} pytest -s -v test

.github/workflows/lint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Linting
23

34
on:

.pre-commit-config.yaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
1+
---
12
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
34
rev: v5.0.0
45
hooks:
56
- id: end-of-file-fixer
67
- id: mixed-line-ending
78
- id: trailing-whitespace
9+
- id: check-yaml
810

9-
- repo: https://github.com/codespell-project/codespell
11+
- repo: https://github.com/codespell-project/codespell
1012
rev: v2.4.1
1113
hooks:
12-
- id: codespell
14+
- id: codespell
1315

14-
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
1517
rev: v0.12.9
1618
hooks:
1719
- id: ruff-check
18-
args: [ --fix ]
20+
args: [--fix]
1921
- id: ruff-format
22+
23+
- repo: https://github.com/adrienverge/yamllint.git
24+
rev: v1.37.1
25+
hooks:
26+
- id: yamllint
27+
args: [--strict, -c=.yamllint.yaml]

.yamllint.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
truthy: disable # Prevent false positives on 'on:' in GitHub workflows
6+
comments: disable # Allow GitHub comment hashes to be separated by a single space for Dependabot compatibility.
7+
line-length: disable # Allow long lines in GitHub workflows due to GitHub hashes.

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ Furthermore if the local branch has evolved from the remote repository an import
8888
To make sure to store the exact revision in the exported data use the command line argument ``--exact``.
8989
Since a specific revision is not tied to neither a branch nor a remote (for Git and Mercurial) the tool will check if the current hash exists in any of the remotes.
9090
If it exists in multiple the remotes ``origin`` and ``upstream`` are considered before any other in alphabetical order.
91-
91+
For compatibility with `yamllint <https://yamllint.readthedocs.io/en/stable/>`_ the output can be formatted by passing the command line argument ``--lint``.
92+
This would add the document start and end markers (``---`` and ``...``) to the output.
9293

9394
Import set of repositories
9495
~~~~~~~~~~~~~~~~~~~~~~~~~~

publish-python.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
artifacts:
23
- type: wheel
34
uploads:

vcs2l/commands/export.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ def get_parser():
4242
default=False,
4343
help='Export unique tag names or commit hashes instead of branch names',
4444
)
45+
group.add_argument(
46+
'--lint',
47+
action='store_true',
48+
default=False,
49+
help='Format output for compatibility with yamllint',
50+
)
51+
4552
return parser
4653

4754

@@ -123,9 +130,13 @@ def main(args=None, stdout=None, stderr=None):
123130
else:
124131
result['path'] = os.path.join(basename, result['path'])
125132

133+
if args.lint:
134+
print('---')
126135
print('repositories:')
127136
output_results(results, output_handler=output_export_data)
128137
output_results(results, output_handler=output_error_information)
138+
if args.lint:
139+
print('...')
129140

130141
any_error = any(r['returncode'] for r in results)
131142
return 1 if any_error else 0

0 commit comments

Comments
 (0)