-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Use git for backup #12252
base: main
Are you sure you want to change the base?
Use git for backup #12252
Changes from 93 commits
094252c
d0f6346
7fd8f89
9ab37a2
d8812ef
af50c7c
e72d408
d427e05
0737f48
f68236f
129d175
b82682a
34a2889
b299e5f
d2b3619
d84fcab
54fa60a
9a8e615
62a8beb
df21a4d
0f9fcb9
7b6ee3f
b67b2d9
3f9584e
76b6f92
fc94296
d6df47a
9a07077
9c86a64
fa42e86
be482cd
2797c01
27f7c47
d070e67
528fe03
d40eadd
11f65c7
8ebb62a
562b285
a2fa8b0
1ad47a3
a580032
9a1c3a1
1013c3c
4daf772
ecad580
c356375
5d22a1a
ae8583a
44f4e17
19b0ef5
7f89d89
850e681
119e5d0
a7d271b
96c3239
5d0afe6
7a48131
47d5238
e881ce4
02fa1d1
c219a98
5ae7407
ebe6f6b
b0cc7f7
7085fc4
3532d2e
08b3c0c
2c6da4b
bca3558
7e63aa2
97caf34
b1c006e
aac4915
a292db3
7ae97d1
5bbefcf
70b123b
69ad0f3
a577ad9
e55a831
cf23e68
61a1987
b515e51
8f06c80
d3b6dd3
2a05da5
dbe6f2b
3d13e22
e065399
01478c7
e4ad25c
da79d5d
a638da5
fa21f0e
fcdd63b
9be1cd2
6c70924
1f9acbe
b45d909
e77e2a5
687d4fd
7477e94
b882f21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ | |
import org.jabref.gui.autocompleter.SuggestionProvider; | ||
import org.jabref.gui.autocompleter.SuggestionProviders; | ||
import org.jabref.gui.autosaveandbackup.AutosaveManager; | ||
import org.jabref.gui.autosaveandbackup.BackupManager; | ||
import org.jabref.gui.autosaveandbackup.BackupManagerGit; | ||
import org.jabref.gui.collab.DatabaseChangeMonitor; | ||
import org.jabref.gui.dialogs.AutosaveUiManager; | ||
import org.jabref.gui.entryeditor.EntryEditor; | ||
|
@@ -105,6 +105,7 @@ | |
import com.tobiasdiez.easybind.Subscription; | ||
import org.controlsfx.control.NotificationPane; | ||
import org.controlsfx.control.action.Action; | ||
import org.eclipse.jgit.api.errors.GitAPIException; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
|
@@ -308,7 +309,7 @@ private void onDatabaseLoadingStarted() { | |
getMainTable().placeholderProperty().setValue(loadingLayout); | ||
} | ||
|
||
private void onDatabaseLoadingSucceed(ParserResult result) { | ||
private void onDatabaseLoadingSucceed(ParserResult result) throws GitAPIException, IOException { | ||
OpenDatabaseAction.performPostOpenActions(result, dialogService, preferences); | ||
if (result.getChangedOnMigration()) { | ||
this.markBaseChanged(); | ||
|
@@ -343,7 +344,7 @@ private void onDatabaseLoadingFailed(Exception ex) { | |
dialogService.showErrorDialogAndWait(title, content, ex); | ||
} | ||
|
||
private void setDatabaseContext(BibDatabaseContext bibDatabaseContext) { | ||
private void setDatabaseContext(BibDatabaseContext bibDatabaseContext) throws GitAPIException, IOException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Method signature changed to throw exceptions but JavaDoc wasn't updated to reflect these changes. When method changes, its documentation must be updated accordingly. |
||
TabPane tabPane = this.getTabPane(); | ||
if (tabPane == null) { | ||
LOGGER.debug("User interrupted loading. Not showing any library."); | ||
|
@@ -367,13 +368,13 @@ private void setDatabaseContext(BibDatabaseContext bibDatabaseContext) { | |
installAutosaveManagerAndBackupManager(); | ||
} | ||
|
||
public void installAutosaveManagerAndBackupManager() { | ||
public void installAutosaveManagerAndBackupManager() throws GitAPIException, IOException { | ||
if (isDatabaseReadyForAutoSave(bibDatabaseContext)) { | ||
AutosaveManager autosaveManager = AutosaveManager.start(bibDatabaseContext); | ||
autosaveManager.registerListener(new AutosaveUiManager(this, dialogService, preferences, entryTypesManager)); | ||
} | ||
if (isDatabaseReadyForBackup(bibDatabaseContext) && preferences.getFilePreferences().shouldCreateBackup()) { | ||
BackupManager.start(this, bibDatabaseContext, Injector.instantiateModelOrService(BibEntryTypesManager.class), preferences); | ||
BackupManagerGit.start(this, bibDatabaseContext, entryTypesManager, preferences); | ||
} | ||
} | ||
|
||
|
@@ -750,7 +751,7 @@ private boolean confirmClose() { | |
} | ||
|
||
if (buttonType.equals(discardChanges)) { | ||
BackupManager.discardBackup(bibDatabaseContext, preferences.getFilePreferences().getBackupDirectory()); | ||
LOGGER.debug("Discarding changes"); | ||
return true; | ||
} | ||
|
||
|
@@ -798,7 +799,7 @@ private void onClosed(Event event) { | |
LOGGER.error("Problem when shutting down autosave manager", e); | ||
} | ||
try { | ||
BackupManager.shutdown(bibDatabaseContext, | ||
BackupManagerGit.shutdown(bibDatabaseContext, | ||
preferences.getFilePreferences().getBackupDirectory(), | ||
preferences.getFilePreferences().shouldCreateBackup()); | ||
} catch (RuntimeException e) { | ||
|
@@ -1078,7 +1079,13 @@ public static LibraryTab createLibraryTab(BackgroundTask<ParserResult> dataLoadi | |
|
||
newTab.setDataLoadingTask(dataLoadingTask); | ||
dataLoadingTask.onRunning(newTab::onDatabaseLoadingStarted) | ||
.onSuccess(newTab::onDatabaseLoadingSucceed) | ||
.onSuccess(result -> { | ||
try { | ||
newTab.onDatabaseLoadingSucceed(result); | ||
} catch (Exception e) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Catches general Exception instead of specific exceptions (GitAPIException and IOException). This violates the principle of catching specific exceptions only. |
||
LOGGER.error("An error occurred while loading the database", e); | ||
} | ||
}) | ||
.onFailure(newTab::onDatabaseLoadingFailed) | ||
.executeWith(taskExecutor); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and also fix the other submodule issues.
You probably have to first sync your main branch with the latest changes from upstream and then your branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello ! I am sorry for the late reply. I applied what is written here https://devdocs.jabref.org/code-howtos/faq.html#submodules to fix the submodules, it worked correctly because I no more have local changes when I execute : git checkout main -- src/main/resources/csl-styles, still, the problem with the submodule csl-styles doesn't seem to be resolved. And can you tell me what changes am I supposed to adress in the CHANGELOG (we already added the suggested edits from the last month, but there is still some changes required by the PR).