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

Preserve bibtex import order #982

Merged
merged 2 commits into from
Mar 17, 2016
Merged

Conversation

tobiasdiez
Copy link
Member

@obraliar #504 (comment) noted that the order of the bibentries in parserResult.getDatabase().getEntries is not the same as in the bib file.
As it turned out, fixing the order required to store the bibentries not as Map<id, BibEntry> but simply as a list. So I removed almost everything which is connected to ID's. Now they are only used for writing bibentries (to determine the original order) and for the sql export.

  • Change in CHANGELOG.md described? Not relevant
  • Changes in pull request outlined? (What, why, ...)
  • Tests created for changes?
  • Tests green?

@tobiasdiez tobiasdiez added cleanup-ops testing status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers labels Mar 16, 2016
@tobiasdiez tobiasdiez mentioned this pull request Mar 16, 2016
@@ -223,7 +219,7 @@ public void actionPerformed(ActionEvent e) {
Globals.prefs.put(JabRefPreferences.EXPORT_WORKING_DIRECTORY, file.getParent());

final File finFile = file;
final Set<String> finEntryIDs = entryIds;
final List<BibEntry> finEntries = entries;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is a new variable introduced?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Further down it is used in an anonymous method, which is only possible if it final.

@oscargus
Copy link
Contributor

👍 (Just one question and one space...)

I guess an intermediate step would be to have a List of ids instead of a Set as that list should probably have a smaller memory footprint compared to bibentry, but as long as it is not a problem (and I guess it isn't, even with thousands of entries), this seems to be the way to go!

@simonharrer
Copy link
Contributor

👍

tobiasdiez added a commit that referenced this pull request Mar 17, 2016
@tobiasdiez tobiasdiez merged commit 57963f7 into JabRef:master Mar 17, 2016
@tobiasdiez tobiasdiez deleted the importOrder branch March 17, 2016 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup-ops status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants