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

Add "Accept external changes" button for "The library has been modified by another program" #8235

Open
mpatas opened this issue Nov 12, 2021 · 12 comments

Comments

@mpatas
Copy link

mpatas commented Nov 12, 2021

When message "The library has been modified by another program" is shown (both when the BibTeX file has been modified by another program and when JabRef itself saves it and bug #4810 or #4877 comes into play), it comes with two buttons (as seen in descriptions of #4810 or #4877):

  1. Dismiss changes
  2. Review changes

However, there are three possibilities:

  1. Use the version open in JabRef, rejecting external modifications
  2. Use the version on the disk, accepting external modifications
  3. Choose something else (maybe look at the changes first, maybe merge those versions in some way)

The first option seems to be covered by "Dismiss changes", the third option is covered by "Review changes", but it looks like nothing covers the second option (other than closing the program and running it again, which seems to be suboptimal).

So, perhaps adding a third button (let's say, "Reload from disk") to the message "The library has been modified by another program" would be a good idea?

@koppor koppor added the ui label Nov 13, 2021
@koppor
Copy link
Member

koppor commented Nov 13, 2021

I will first fix #4877 then we can come back to here.

Assume the "Review changes" functionality would work (which is our aim). Then the button "Reload from disk" would assume that the user blindly trusts the content on disk and his own changes will be overwritten?

I think, the issue is that the change detection is not working well. This can cause risk that "Reload from disk" destroys in-memory data - in the use case of a shared .bib file (e.g., dropbox, onedrive, ...)

This strongly refs #5669

@mpatas
Copy link
Author

mpatas commented Nov 13, 2021

Assume the "Review changes" functionality would work (which is our aim). Then the button "Reload from disk" would assume that the user blindly trusts the content on disk and his own changes will be overwritten?

Sometimes the user does trust the content on disk, and does so for a good reason.

For example, that happens when the user was working on a different computer and has put a new version to the disk using FTP, Git, E-Mail or something else.

Sure, there are other cases when pressing such a button would be a bad idea, which is a good reason for having three buttons and not one.

But, of course, such a button would be less important, if the changes of files are going to be detected correctly.

@koppor koppor added good first issue An issue intended for project-newcomers. Varies in difficulty. type: feature labels Nov 14, 2021
@OlafKleinBerlin
Copy link

I would like to suggest to point out in the choices which one will dismiss the changes one had done in Jabref and which one will dismiss the one changes according to the changed file.

@NYH-Dolphin
Copy link
Contributor

Hi, I am a junior student and now I am learning software engineering. I have read your development documentation https://devdocs.jabref.org/contributing.
I am wondering whether I can try to solve this problem. Am I the first person who proposed to solve this problem?

@koppor
Copy link
Member

koppor commented Mar 7, 2022

@NYH-Dolphin I am working on the underlying issue (as written at #8235 (comment)). This issue is about the UI.

The issue is about having three buttons when a change on the disk occurred:

  • Use the opened version (currently "Dismiss changes"; already exiting)
  • Use the version on the disk (currently not existing)
  • Review changes (already existing)

The main challenge will be the localization. - Jsut go ahead!

@NYH-Dolphin
Copy link
Contributor

Hi Jabref, I am trying to fix this issue now. I am wondering whether [Accept Changes] need to automatically save the modified file? This need to call the variable of SaveDatabaseAction in the DatabaseChangeMonitor class. I am not sure whether I have break the calling rules?

This is the part that I am trying to modify
image

In order to implement this function, I have to pass the LibarayTab parameter instead of LibraryTab.DatabaseNotification class.
image
So the parameters passed are just like this
image

@NYH-Dolphin
Copy link
Contributor

Now when Jabref detects the violation, it will display a dialogue like this
image

When you click [Accept changes], it will quickly show the changes and save it automatically
image

@DesBw
Copy link

DesBw commented May 13, 2022

Is it possible to make [accept external changes] automatic?
One can set it to always accept external changes: like in Texstudio.

@koppor
Copy link
Member

koppor commented May 31, 2022

Is it possible to make [accept external changes] automatic? One can set it to always accept external changes: like in Texstudio.

What would be the use case? I fear that "silently" accepting external changes and always overwriting local changes is not that good, is it? - Maybe, there is never the case there is data in the entry editor, but I would like to be really sure...

@ThiloteE ThiloteE changed the title "Reload from disk" for "The library has been modified by another program" "Accept external changes" for "The library has been modified by another program" Aug 16, 2022
@ThiloteE
Copy link
Member

ThiloteE commented Aug 20, 2022

Actually, I think there are 4 options:

  1. Use the opened version (currently "Dismiss changes"; already exiting)
  2. Use the version on the disk (currently not existing, but exists within the "Review changes" dialogue)
  3. Use the version on the disk, which was changed AFTER JabRef created the "The library has been modified by another program" (does not exist) --> Refs. External Changes to library are not tracked while reviewing external changes #9074
  4. Review changes (already existing)

@ThiloteE
Copy link
Member

This issue should have become less important overall, as

  1. 6a71395 should have fixed bugs "The library has been modified by another program" while no other program is active on the library #4810 and When saving: The libary has been modified by another program #4877, therefore this popup will trigger A LOT less often.
  2. Accepting external changes can be done from within the "Review Changes" dialogue (using the new implementation of [WIP][GSOC22] - C - Improve the external changes resolver dialog #9021:
    grafik

@ThiloteE ThiloteE changed the title "Accept external changes" for "The library has been modified by another program" Add "Accept external changes" button for "The library has been modified by another program" Aug 20, 2022
@ThiloteE ThiloteE removed the good first issue An issue intended for project-newcomers. Varies in difficulty. label Sep 10, 2022
@koppor
Copy link
Member

koppor commented Apr 16, 2024

State of today: "Accept changes" is not available:

image


I think, it is because we wanted the user to check the external changes and not just overwrite any changes the user did during editing.

@claell @mpatas May I ask how often you run into this? I would have pressed "Dismiss changes" and immediately closed the library (and reopened it again) to have the same effect. -- I think, your use case is that you are using git and switching branches (refs koppor#578) and just want to say: Yeah, dear JabRef, just reload from disk. I know what I am doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Low priority
Development

No branches or pull requests

6 participants