Closed MichalVasut closed 1 year ago
Thanks for the report, that does indeed look like an issue.
Unfortunately I've not been able to reproduce this. Specifically, on my system there seems to be a difference in how the configuration is parsed:
2023-05-04T15:54:12.583 DEBUG bumpver.config - Config Parsed: Config(
current_version='1.2.10',
version_pattern='MAJOR.MINOR.PATCH',
pep440_version='1.2.10',
commit_message='bump version {old_version} -> {new_version}',
commit=True,
tag=False,
push=False,
is_new_pattern=True,
file_patterns={
'VERSION': 'MAJOR.MINOR.PATCH',
'bumpver.toml': 'current_version = "MAJOR.MINOR.PATCH"',
}
)
As compared to yours:
file_patterns={
'bumpver.toml': 'current_version = "MAJOR.MINOR.PATCH"',
'version': 'MAJOR.MINOR.PATCH',
}
Can you update to 2023.1121
and try again, or somehow narrow down the issue?
The tests also run on MacOS in the CI system, so if you can write a test that triggers the issue in the CI, then that would be helpful.
Can you update to 2023.1121
Unfortunately I cannot, currently I don't have personal device with Windows, it's from work, where we have restricted rights to make system update. (if we are talking about Windows version and I'm not even sure what version is installed - I'll check it later).
or somehow narrow down the issue?
I'll try to pinpoint it from soitcecode, it should be imho something with that name parsing or handling, that is different across platforms...
I've just noticed this on my Windows based system. That it didn't commit files, and when I look back it is all files with upper and lower case names that didn't get added in for the bumpver commit.
Version in use:
$ bumpver --version
bumpver, version 2023.1121
Commit done by bumpver:
$ git show --pretty="" --name-only 61b4d9ae6e13db132414cffedf0408581eff97e9
bumpver.toml
netbox/minder/__init__.py
netbox/minder/choices.py
netbox/minder/interogatecore.py
netbox/minder/minder.py
netbox/minder/radiuscreds.py
netbox/reports/__init__.py
netbox/scripts/__init__.py
netbox/scripts/add_fibre.ios.j2
netbox/scripts/add_nbn.ios.j2
netbox/scripts/add_sip.j2
netbox/scripts/hosting.ios.j2
netbox/scripts/mindertenants.py
netbox/scripts/template.ios.j2
Following commit, with no actual changes made to these files since the bumpver commit:
$ git show --pretty="" --name-only a7004bd1295108b269c99dc646b3af5eb509a51a
netbox/reports/DeviceRacking.py
netbox/scripts/AddDeviceTypeComponents.py
netbox/scripts/MinderTools.py
netbox/scripts/ServiceFibre.py
netbox/scripts/ServiceHosting.py
netbox/scripts/ServiceNBN.py
netbox/scripts/ServiceSIP.py
Thanks for the extra info @jscooksey.
If you have any ability to debug this further, I'd greatly appreciate it.
Yes, I'll take a bit more of a look at it this evening. I also have a MacOS machine as well, so I'll see if that's doing the same thing.
Just quickly I pulled the /test/fixtures/project_b folders
Same as before, it added all lower case including the new lower.py, but didn't add any that had upper case, including README.rst byt the looks
Anyway, I'll have more time to look through it later.
On MacOS it hasn't had the same issue, and has worked fine Python is 3.10.6 whereas the Windows 11 machine has 3.9.x Both have the same version of bumpver
git show --pretty="" 2391d2f81d909b74930539d39e79390e7ac4d6e9 --name-only
bumpver.toml
netbox/minder/__init__.py
netbox/minder/choices.py
netbox/minder/interogatecore.py
netbox/minder/minder.py
netbox/minder/radiuscreds.py
netbox/reports/DeviceRacking.py
netbox/reports/__init__.py
netbox/scripts/AddDeviceTypeComponents.py
netbox/scripts/MinderTools.py
netbox/scripts/ServiceFibre.py
netbox/scripts/ServiceHosting.py
netbox/scripts/ServiceNBN.py
netbox/scripts/ServiceSIP.py
netbox/scripts/__init__.py
netbox/scripts/add_fibre.ios.j2
netbox/scripts/add_nbn.ios.j2
netbox/scripts/add_sip.j2
netbox/scripts/hosting.ios.j2
netbox/scripts/mindertenants.py
netbox/scripts/template.ios.j2
I tried setting git global options on the Win11 machine
git config --global core.ignorecase true
just in case it was to do with that. But true or false made no difference and bumpver didn't add the files with upper case in the names.
I tried to get a fork working on the Win11 system as well, but had a few issues with that and Conda and make.
In just doing pytest I got folder access denied for temp folders, which seemed a bit odd, as the folders are under my profile so should have been fine. But I didn't dig to much further into it tonight.
Walked in the code a little, vcs.py#LINE252
I'll try and have more of a crack later
OK, it seems to be the call out to git to add files under Windows.
From the looks of some of the output as it runs, it appears filenames are all taken to lowercase during processing within bumpver. So when it call out git to add the file UpperCase.py its calling:
git add --update uppercase.py
Current git config is core.ignorecase=false
The Windows version of git must looks for matching case, as it errors out not finding the file as shown manually below:
$ git commit
[main ebc1774] yep
1 file changed, 4 insertions(+)
$ git diff --name-only --cached
$ nano netbox/wip/UpperCase.py
#
# Changed the content
#
$ git add --update netbox/wip/uppercase.py
fatal: pathspec 'netbox/wip/uppercase.py' did not match any files
$ git diff --name-only --cached
$ git add --update netbox/wip/UpperCase.py
warning: in the working copy of 'netbox/wip/UpperCase.py', LF will be replaced by CRLF the next time Git touches it
$ git diff --name-only --cached
netbox/wip/UpperCase.py
$ git commit
[main 3291f08] again
1 file changed, 1 insertion(+), 1 deletion(-)
$
With git config is core.ignorecase=true
it didnt throw the did not match any files error
$ git diff --name-only --cached
$ git add --update netbox/wip/uppercase.py
$ git diff --name-only --cached
$ git add --update netbox/wip/UpperCase.py
warning: in the working copy of 'netbox/wip/UpperCase.py', LF will be replaced by CRLF the next time Git touches it
$ git diff --name-only --cached
netbox/wip/UpperCase.py
I've been seeing this same issue on my windows machine. I see that all my filenames in bumpver.file_patterns
are being returned in lowercase. For my machine, I've tracked this to the use of pathlib2
. In _iter_glob_expanded_file_patterns
line 255 in config.py is the line:
filepaths = list(pl.Path().glob(filepath_glob))
If I have a filepath_glob that has mixed case like "MixedCaseFile.txt", then this line returns a WindowsPath with the name in all lowercase. I can look into this more, but this seems to be the cause of the error for me.
I'm using a test in test_cli.py to check this right now.
def test_filename_case(request, monkeypatch):
runner = CliRunner()
monkeypatch.chdir(request.path.parent / "fixtures" / "project_e")
result = runner.invoke(cli.cli, ["update", "--dry", "-n", "--patch"])
assert result.exit_code == 0
assert "MixedCaseFile.txt" in result.output.rstrip()
The project_e fixture has a file named MixedCaseFile.txt and a bumpver.toml file with the following contents.
[bumpver]
current_version = "0.0.0"
version_pattern = "MAJOR.MINOR.PATCH"
commit_message = "bump version {old_version} -> {new_version}"
commit = true
tag = false
push = false
[bumpver.file_patterns]
"bumpver.toml" = [
'current_version = "{version}"',
]
"MixedCaseFile.txt" = [
'{version}'
]
One workaround for now is to add an *
after the filename to make it a glob pattern. pathlib2
doesn't do case folding for this. Caution should be taken that you won't pick up other files. I've tried this with the current version and it worked.
[bumpver.file_patterns]
"bumpver.toml" = [
'current_version = "{version}"',
]
"MixedCaseFile.txt*" = [
'{version}'
]
"VERSION*" = [
'{version}'
]
I have raised the issue with pathlib2: https://github.com/jazzband/pathlib2/issues/86
Hello, there seems to be issue with case sensitivity of file names during git add...
When I remae the file to lower case (
version
), it works as expected.