Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from OSGeo:master #167

Merged
merged 8 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/10_bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ body:

The GDAL project is made of contributions from various individuals and organizations, each with their own focus. The issue you are facing is not necessarily in the priority list of those contributors and consequently there is no guarantee that it will be addressed in a timely manner. If this bug report or feature request is high-priority for you, and you cannot address it yourself, we suggest engaging a GDAL developer or support organisation and financially sponsoring a fix.

- type: markdown
attributes:
value: |

- [ ] I'm using LLM/AI-suggested procedures

Using GDAL still requires thinking. While LLMs can sometimes provide useful guidance about how to use GDAL, the most precise documentation is the source code itself, with the test suite being the next most useful place for discovering how to use a feature. Please tell us in the ticket if you are using LLM-suggested procedures.

- type: textarea
id: what
attributes:
Expand Down
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ More generally, consult [development practices](https://gdal.org/development/dev

## Tasklist

- [ ] ADD YOUR TASKS HERE
- [ ] AI (Copilot or something similar) supported my development of this PR
- [ ] Make sure code is correctly formatted (cf [pre-commit configuration](https://gdal.org/development/dev_practices.html#commit-hooks))
- [ ] Add test case(s)
- [ ] Add documentation
- [ ] Updated Python API documentation (swig/include/python/docs/)
- [ ] Review
- [ ] Adjust for comments
- [ ] All CI builds and checks have passed
- [ ] ADD YOUR TASKS HERE

## Environment

Expand Down
3 changes: 2 additions & 1 deletion apps/argparse/argparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,8 @@ class ArgumentParser {
}
}
cur_mutex = arg_mutex;
if (curline.size() + 1 + arg_inline_usage.size() >
if (curline.size() != indent_size &&
curline.size() + 1 + arg_inline_usage.size() >
this->m_usage_max_line_width) {
stream << curline << std::endl;
curline = std::string(indent_size, ' ');
Expand Down
2 changes: 1 addition & 1 deletion apps/gdalargumentparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GDALArgumentParser::GDALArgumentParser(const std::string &program_name,
bool bForBinary)
: ArgumentParser(program_name, "", default_arguments::none)
{
set_usage_max_line_width(120);
set_usage_max_line_width(80);
set_usage_break_on_mutex();
add_usage_newline();

Expand Down
56 changes: 54 additions & 2 deletions autotest/ogr/ogr_gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -9178,8 +9178,10 @@ def test_ogr_gpkg_read_generated_column(tmp_vsimem):
lyr = ds.GetLayer(0)
assert lyr.GetLayerDefn().GetFieldCount() == 4
assert lyr.GetLayerDefn().GetFieldDefn(2).GetName() == "strfield_generated"
assert lyr.GetLayerDefn().GetFieldDefn(2).IsGenerated()
assert lyr.GetLayerDefn().GetFieldDefn(2).GetType() == ogr.OFTString
assert lyr.GetLayerDefn().GetFieldDefn(3).GetName() == "intfield_generated_stored"
assert lyr.GetLayerDefn().GetFieldDefn(3).IsGenerated()
assert lyr.GetLayerDefn().GetFieldDefn(3).GetType() == ogr.OFTInteger64

f = ogr.Feature(lyr.GetLayerDefn())
Expand All @@ -9191,6 +9193,8 @@ def test_ogr_gpkg_read_generated_column(tmp_vsimem):
assert f["strfield"] == "foo"
assert f["strfield_generated"] == "foo_generated"
assert f["intfield_generated_stored"] == 5
assert f.GetFieldDefnRef(2).IsGenerated()
assert f.GetFieldDefnRef(3).IsGenerated()

assert lyr.SetFeature(f) == ogr.OGRERR_NONE
lyr.ResetReading()
Expand Down Expand Up @@ -10914,8 +10918,56 @@ def test_ogr_gpkg_arrow_stream_numpy_datetime_as_string(tmp_vsimem):
# Test field operations rolling back changes.


def test_ogr_gpkg_field_operations_rollback(tmp_vsimem):
@pytest.mark.parametrize("start_transaction", [False, True])
def test_ogr_gpkg_field_operations_rollback(tmp_vsimem, start_transaction):

filename = str(tmp_vsimem / "test.gpkg")
with ogr.GetDriverByName("GPKG").CreateDataSource(filename) as ds:
ogrtest.check_transaction_rollback(ds, test_geometry=False)
ogrtest.check_transaction_rollback(ds, start_transaction, test_geometry=False)


@pytest.mark.parametrize("start_transaction", [False, True])
def test_ogr_gpkg_field_operations_savepoint_rollback(tmp_vsimem, start_transaction):

filename = str(tmp_vsimem / "test_savepoint.gpkg")
with ogr.GetDriverByName("GPKG").CreateDataSource(filename) as ds:
ogrtest.check_transaction_rollback_with_savepoint(
ds, start_transaction, test_geometry=False
)


@pytest.mark.parametrize("auto_begin_transaction", [False, True])
@pytest.mark.parametrize("start_transaction", [False, True])
@pytest.mark.parametrize(
"release_to,rollback_to,expected",
(
([1], [], ["fld3"]),
([2], [], ["fld3"]),
([3], [], ["fld3"]),
([4], [], ["fld3"]),
([], [1], ["fld1", "fld2", "fld3", "fld4", "fld5"]),
([], [2], ["fld1", "fld3", "fld4", "fld5"]),
([], [3], ["fld1", "fld3", "fld5"]),
([], [4], ["fld3", "fld5"]),
),
)
def test_ogr_gpkg_field_operations_savepoint_release(
tmp_vsimem,
auto_begin_transaction,
start_transaction,
release_to,
rollback_to,
expected,
):

filename = str(tmp_vsimem / "test_savepoint_release.gpkg")
ogrtest.check_transaction_savepoint_release(
filename,
"GPKG",
auto_begin_transaction,
start_transaction,
release_to,
rollback_to,
expected,
test_geometry=False,
)
54 changes: 50 additions & 4 deletions autotest/ogr/ogr_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -4543,10 +4543,56 @@ def test_ogr_sqlite_schema_override(
#


def test_field_rollback(tmp_path):
@pytest.mark.parametrize("start_transaction", [False, True])
def test_ogr_sqlite_field_operations_rollback(tmp_vsimem, start_transaction):

filename = str(tmp_path / "test_field_rollback.db")
filename = str(tmp_vsimem / "test.db")
with ogr.GetDriverByName("SQLite").CreateDataSource(filename) as ds:
ogrtest.check_transaction_rollback(ds, start_transaction, test_geometry=False)


@pytest.mark.parametrize("start_transaction", [False, True])
def test_ogr_sqlite_field_operations_savepoint_rollback(tmp_vsimem, start_transaction):

# Create a new database.
filename = str(tmp_vsimem / "test_savepoint.db")
with ogr.GetDriverByName("SQLite").CreateDataSource(filename) as ds:
ogrtest.check_transaction_rollback(ds, test_geometry=True)
ogrtest.check_transaction_rollback_with_savepoint(
ds, start_transaction, test_geometry=False
)


@pytest.mark.parametrize("auto_begin_transaction", [False, True])
@pytest.mark.parametrize("start_transaction", [False, True])
@pytest.mark.parametrize(
"release_to,rollback_to,expected",
(
([1], [], ["fld3"]),
([2], [], ["fld3"]),
([3], [], ["fld3"]),
([4], [], ["fld3"]),
([], [1], ["fld1", "fld2", "fld3", "fld4", "fld5"]),
([], [2], ["fld1", "fld3", "fld4", "fld5"]),
([], [3], ["fld1", "fld3", "fld5"]),
([], [4], ["fld3", "fld5"]),
),
)
def test_ogr_sqlite_field_operations_savepoint_release(
tmp_vsimem,
auto_begin_transaction,
start_transaction,
release_to,
rollback_to,
expected,
):

filename = str(tmp_vsimem / "test_savepoint_release.db")
ogrtest.check_transaction_savepoint_release(
filename,
"SQLite",
auto_begin_transaction,
start_transaction,
release_to,
rollback_to,
expected,
test_geometry=False,
)
Loading
Loading