Same operations as GitCommitAction and GitPushAction, but started by a save or a timer
instead of the user. Failures are reported as notifications rather than dialogs. A conflict
during the pull before an auto-push still prompts, because the user is present for the save
that started it; a scheduled pull runs unattended and stays silent.
| Modifier and Type | Field and Description |
|---|---|
| private final DialogService | |
| private final GitHandlerRegistry | |
| private final GuiPreferences | |
| private static final Logger | |
| private final StateManager | |
| private final TaskExecutor |
| Access | Constructor and Description |
|---|---|
| public | GitAutoSync(DialogService dialogService, GitHandlerRegistry gitHandlerRegistry, TaskExecutor taskExecutor, GuiPreferences guiPreferences, StateManager stateManager)
|
| Modifier and Type | Method and Description |
|---|---|
| private void | applyCleanMerge(Path bibFilePath, BibDatabaseContext databaseContext, PullPlan pullPlan, BooleanSupplier hasUnsavedChanges)
|
| private void | |
| public void | commit(Path bibFilePath, BibDatabaseContext databaseContext)
Commits the library if it is inside a Git repository. |
| private void | |
| public void | commitAndPush(Path bibFilePath, BibDatabaseContext databaseContext)
Commits the library if it is inside a Git repository, and pushes afterwards. |
| private boolean | |
| private Optional | |
| public void | pull(Path bibFilePath, BibDatabaseContext databaseContext, BooleanSupplier hasUnsavedChanges)
Pulls remote changes if the library is inside a Git repository. |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | showPullResult(BookkeepingResult bookkeepingResult, MergePlan autoPlan)
Reports what a scheduled pull changed, and stays quiet when it changed nothing. |
| private void | |
| private GitSyncService | |
| private org.jabref.logic.util.BackgroundTask |
| dialogService | back to summary |
|---|---|
| private final DialogService dialogService | |
| gitHandlerRegistry | back to summary |
|---|---|
| private final GitHandlerRegistry gitHandlerRegistry | |
| guiPreferences | back to summary |
|---|---|
| private final GuiPreferences guiPreferences | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| stateManager | back to summary |
|---|---|
| private final StateManager stateManager | |
| taskExecutor | back to summary |
|---|---|
| private final TaskExecutor taskExecutor | |
| GitAutoSync | back to summary |
|---|---|
| public GitAutoSync(DialogService dialogService, GitHandlerRegistry gitHandlerRegistry, TaskExecutor taskExecutor, GuiPreferences guiPreferences, StateManager stateManager) | |
| applyCleanMerge | back to summary |
|---|---|
| private void applyCleanMerge(Path bibFilePath, BibDatabaseContext databaseContext, PullPlan pullPlan, BooleanSupplier hasUnsavedChanges) | |
| applyMerge | back to summary |
|---|---|
| private void applyMerge(Path bibFilePath, BibDatabaseContext databaseContext, PullPlan pullPlan) | |
| commit | back to summary |
|---|---|
| public void commit(Path bibFilePath, BibDatabaseContext databaseContext) Commits the library if it is inside a Git repository. does nothing if the library file is unchanged | |
| commit | back to summary |
|---|---|
| private void commit(Path bibFilePath, BibDatabaseContext databaseContext, boolean pushAfterCommit) | |
| commitAndPush | back to summary |
|---|---|
| public void commitAndPush(Path bibFilePath, BibDatabaseContext databaseContext) Commits the library if it is inside a Git repository, and pushes afterwards. does nothing if the library file is unchanged | |
| doCommit | back to summary |
|---|---|
| private boolean doCommit(GitHandler gitHandler, Path bibFilePath) throws org.jabref.logic.JabRefException, GitAPIException, IOException | |
| preparePull | back to summary |
|---|---|
| private Optional | |
| pull | back to summary |
|---|---|
| public void pull(Path bibFilePath, BibDatabaseContext databaseContext, BooleanSupplier hasUnsavedChanges) Pulls remote changes if the library is inside a Git repository. Skips quietly when there are uncommitted changes or the merge has conflicts, because no user started this operation. | |
| pullThenPush | back to summary |
|---|---|
| private void pullThenPush(Path bibFilePath, BibDatabaseContext databaseContext) | |
| push | back to summary |
|---|---|
| private void push(Path bibFilePath, BibDatabaseContext databaseContext) | |
| showCommitError | back to summary |
|---|---|
| private void showCommitError(Exception exception) | |
| showPullError | back to summary |
|---|---|
| private void showPullError(Exception exception) | |
| showPullResult | back to summary |
|---|---|
| private void showPullResult(BookkeepingResult bookkeepingResult, MergePlan autoPlan) Reports what a scheduled pull changed, and stays quiet when it changed nothing. | |
| showPushError | back to summary |
|---|---|
| private void showPushError(Exception exception) | |
| syncService | back to summary |
|---|---|
| private GitSyncService syncService() | |
| writeAndFinalize | back to summary |
|---|---|
| private org.jabref.logic.util.BackgroundTask | |