Repository navigation
Keep string constants when importing BibTeX into an existing library - #17957
AnishKmSingh wants to merge 3 commits into
Conversation
PR Summary by QodoPreserve BibTeX string definitions and references during import
AI Description
Merge Risk
|
Code Review by Qodo
1. Escaped hashes change in imported text
|
|
Nice work overall fix is fine , kindly check these |
… merge strings into the selected library
|
@doraem-on |
Summary
When importing a BibTeX file into an existing library, the
@Stringconstants of the imported file were dropped, becauseImportResultsMergeronly copied the entries. References such asjournal = venuethen resolved to the library's ownvenue, so the imported entry silently showed a different journal.ImportResultsMergernow keeps the string constants of BibTeX imports. If a string with the same name but different content already exists,DatabaseMergeradds the imported one with a new name (e.g.,venue_1, as before) and now also updates the references in the imported entries to that name.The dialog to choose between the existing and the imported definition (suggested in the issue) will follow in a separate PR.
Follow-up PR: as suggested in the issue, I'd like to add a dialog in a separate PR so the user can decide what happens when a string name clashes, similar to "Import customized entry types". For each conflicting string, it would show the existing and the imported value and offer:
Renaming only appends a suffix (e.g.,
aKopp→aKopp_1), so the string type prefix is kept. I kept this PR small so the data issue can be fixed first, and the dialog can be reviewed on its own.Steps to test
target.bib:@string{venue = {Journal of Biology}}
@Article{Existing2025, title = {Existing biology paper}, journal = venue, year = {2025}}
incoming.bib:@string{venue = {Journal of Computer Science}}
@Article{Incoming2026, title = {Imported computer science paper}, journal = venue, year = {2026}}
target.bib, then File → Import → Import into current library →incoming.bib→ Import entries.journal = venue_1); the existing article still shows "Journal of Biology".Before fix:
After Fix:
Related issues and pull requests
Refs #17895
AI usage
Claude (Anthropic), Claude Opus 5.5 find the root cause (string constants dropped in
ImportResultsMerger) and drafted the code, tests and CHANGELOG entry. I reproduced the bug, applied the changes, ran the tests locally, verified the fix manually in JabRef (screenshots above), and reviewed and understood all changes. I take full ownership of the code.Checklist
CHANGELOG.mddescribing the change from the user's point of view (if the change is visible to the user)