jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Add git support

Open lbenicio opened this issue 1 year ago • 20 comments

Fixes https://github.com/koppor/jabref/issues/578

  • SSH auth method
  • Username/password dialog box auth method
  • Username/password env variables auth method
  • Store username/password in JabRef preferences
  • Fail silently
  • Support for local and remote git repositories
credentialsDialog preferencesPanel

Mandatory checks

  • [x] Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • [x] Tests created for changes (if applicable)
  • [x] Manually tested changed features in running JabRef (always required)
  • [x] Screenshots added in PR description (for UI changes)
  • [x] Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • [x] Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

lbenicio avatar Oct 25 '23 22:10 lbenicio

* Store username/password in JabRef preferences

Do you use our new way to store passwords? Using https://github.com/javakeyring/java-keyring?

Did you try the integration with Git Credential Manager?

koppor avatar Nov 21 '23 09:11 koppor

Please fix compile errors

home/runner/work/jabref/jabref/src/main/java/org/jabref/gui/collab/ExternalChangesResolverViewModel.java:57: error: name clash: ExternalChangesResolverViewModel(List<GitChange>,UndoManager) and ExternalChangesResolverViewModel(List<DatabaseChange>,UndoManager) have the same erasure

    public ExternalChangesResolverViewModel(List<GitChange> changes2, UndoManager undoManager2) {
           ^

koppor avatar Nov 21 '23 13:11 koppor

sorry about the compile errors, it was a WIP of the git merge conflicts resolver we were trying to implement.

lbenicio avatar Nov 21 '23 21:11 lbenicio

Please fix compile errors

home/runner/work/jabref/jabref/src/main/java/org/jabref/gui/collab/ExternalChangesResolverViewModel.java:57: error: name clash: ExternalChangesResolverViewModel(List<GitChange>,UndoManager) and ExternalChangesResolverViewModel(List<DatabaseChange>,UndoManager) have the same erasure

    public ExternalChangesResolverViewModel(List<GitChange> changes2, UndoManager undoManager2) {
           ^

i believe we will need to update it

lbenicio avatar Nov 21 '23 21:11 lbenicio

@koppor currently we are developing the rebase conflicts resolver view, and we should be good to go for another, and hopefully last, PR

lbenicio avatar Nov 21 '23 22:11 lbenicio

@koppor currently we are developing the rebase conflicts resolver view, and we should be good to go for another, and hopefully last, PR

Please do not do another pull request, please just push commits (as you did)

Maybe @lbenicio you overlooked my comments

https://github.com/JabRef/jabref/pull/10586#pullrequestreview-1740637199

for a deeper (and soon) feedback, I would need screenshot of the git diff dialogs.

This means: Please do attach a screenshot of the git diff dialog WITH DATA which you implemented

https://github.com/JabRef/jabref/pull/10586#issuecomment-1820582681

* Store username/password in JabRef preferences

Do you use our new way to store passwords? Using https://github.com/javakeyring/java-keyring? - Reformulated: Can you tell us how you store passwords in the preferences? (you can also share a link to the precise location in the code)

Did you try the integration with Git Credential Manager?

koppor avatar Nov 23 '23 11:11 koppor

We are migrating our implementation to use java key ring, we were not using it. Now we see the problem. The diff dialog is still under heavy issues (I added the files from the database diff but still difficulty to navigate how to change it to git diffs). It seems more challenging them what we have thought.

lbenicio avatar Nov 25 '23 14:11 lbenicio

@lbenicio you can replace the whole diff dialog by using JabRefs own feature to compare two libraries (bib files). Remember, the is the "file changed on disk" feature of JabRef. Maybe, you simply write out the file of the remote to the disk and then let JabRef do it's magic. The magic includes a) displaying all diffs and b) guiding the user through accepting, rejecting, and merging changes.

koppor avatar Nov 27 '23 09:11 koppor

@koppor We thought, as a v1, we could just create a text dialog with the diff output from the user and let the user decide

lbenicio avatar Nov 28 '23 15:11 lbenicio

@lbenicio As I understand you, the dialog does not work. What I say: Remove that code, add approx. three lines of code and let JabRef do its magic. For sure, you can train your JavaFX skills with your dialog. Then please add screenshots!

koppor avatar Nov 28 '23 19:11 koppor

I don't quite understand how that will work as the class uses bib files, but i will try.

lbenicio avatar Nov 29 '23 20:11 lbenicio

@lbenicio you can replace the whole diff dialog by using JabRefs own feature to compare two libraries (bib files). Remember, the is the "file changed on disk" feature of JabRef. Maybe, you simply write out the file of the remote to the disk and then let JabRef do it's magic. The magic includes a) displaying all diffs and b) guiding the user through accepting, rejecting, and merging changes.

I tried to pull before save the bib file, but i think file monitor is more slow than save action. Is it possible to check in file monitor if a conflict happened and if user resolved it ?

marcelojunior1 avatar Nov 30 '23 01:11 marcelojunior1

I tried to pull before save the bib file, but i think file monitor is more slow than save action.

The file monitor monitors the file on the disk. Thus, it cannot be slower than the save action.

Is it possible to check in file monitor if a conflict happened and if user resolved it ?

No. There are other listeners taking care of the work. For the first "MVP", it is enough to save the pulled file and let the user to the work - without going back the path of the save call. The handling of conflicts will be done in another independent thread then.

koppor avatar Dec 04 '23 12:12 koppor

Happy new year! 🎉

This PR could take longer to be finished. Do you still have some time?

If yes, I would ask you to check the CI output: Checkstyle complains and some other checkers, too. Please check their output. Especially reconfigure IntelliJ to follow JabRef's code style. See https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html for details. You can then use Ctrl+Alt+L to reformat your classes.

koppor avatar Jan 02 '24 21:01 koppor

I make the changes, but I don't understand this changelog.md error.

marcelojunior1 avatar Jan 14 '24 01:01 marcelojunior1

I make the changes, but I don't understand this changelog.md error.

Not sure, how I should explain.

You know software releases? You know that for each version, there is a section in CHANGELOG.md. Thus, for each released version, there is a section.

What if updates to the software come? Are older releases changed? No, new releases are made! - What about the CHANGELOG.md sections of older releases? Do new features go into these sections? No, a new section unreleased is used.

Now, let's check your patch:

image

The patch is in section of version 5.11 of JabRef. It adds a new feature to 5.11. BUT - hey, JabRef 5.11 is already released. See the release date in the heading and the releases at https://github.com/JabRef/jabref/releases.

Thus, this patch should NOT go into 5.11, but into the unreleased section of CHANGELOG.md

koppor avatar Jan 14 '24 16:01 koppor

All right, and this last one, is it related to what we did?

marcelojunior1 avatar Jan 14 '24 23:01 marcelojunior1

All right, and this last one, is it related to what we did?

I don't understand, where "last one" refers to...

koppor avatar Jan 22 '24 17:01 koppor

These Fetcher tests.

marcelojunior1 avatar Jan 22 '24 20:01 marcelojunior1

You can ignore the fetcher tests

Marcelo Nascimento @.***> schrieb am Mo., 22. Jan. 2024, 21:25:

These Fetcher tests.

— Reply to this email directly, view it on GitHub https://github.com/JabRef/jabref/pull/10586#issuecomment-1904748473, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACOFZDHVKABZOHT7XPOVNDYP3DNLAVCNFSM6AAAAAA6QCNEUWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBUG42DQNBXGM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Siedlerchr avatar Jan 22 '24 22:01 Siedlerchr

Unfortunately, my classes started a few days ago and I will not be able to continue this project. If there is someone else who can continue this issue, you can pass it on.

marcelojunior1 avatar Mar 01 '24 03:03 marcelojunior1

Ok, yes, we will look into it. Thanks for your work on enhancing JabRef.

calixtus avatar Mar 01 '24 13:03 calixtus