omegat icon indicating copy to clipboard operation
omegat copied to clipboard

Changing the flow of updating teamwork omegat.project (Successor of #122)

Open miurahr opened this issue 4 years ago • 11 comments

This patch changes the flow of updating local teamwork "omegat.project" file with the content of remote copy of "omegat.project" on the git server.

Before this patch, the content of remote copy overwrites the local copy first, and then if the content lacks the git setting, it was added and then the "omegat.project" was updated to reflect the addition.

However, if OmegaT terminated early, such update may not happen and thus rendering the teamwork without proper git setting. When the remote copy of "omegat.project" lacks git setting, on the next opening, the project may no longer be a teamwork project (!). This confuses the end users to no end.

Pull request type

Please check the type of change your PR introduces:

  • [x] Bug fix
  • [x] Feature
  • [ ] Documentation
  • [ ] Build and release changes
  • [ ] Other (describe below)

Which ticket is resolved?

  • Link:
  • Title:

What does this PR change?

This patch changes the workflow of update as follows.

  1. Content of the remote copy of "omegat.project" on the server is written to local file, "omegat.project.NEW".

  2. The content of this file is parsed.

  3. If git-setting is missing in the content, it is added from then current setting from the local copy of "omegat.project". In this case, rewriting from the content of the remote copy does not happen.

  4. Only if the remote copy is good enough to replace the current local copy, then we create a backup copy of the old "omegat.project" in "omegat.project.TIMESTAMP.bak". Then we RENAME "omegat.project.NEW" to "omegat.project".

With this flow, there is always a working copy of omegat.project on the local computer even if OmegaT terminates early. So we don't end up with incorrect non-teamwork copy even if the remote copy of "omegat.project" lacks git setting.

Also, this patch displays a warning dialog to warn the user when the remote copy of omegat.project on the git server lacks git setting. This should help end users to detect the wrong configuration early on.

Other information

This PR is successor of PR #122 which has not been no response from original author.

miurahr avatar Feb 26 '22 04:02 miurahr

Integration test passed with 10 min. duration against git+ssh server.

miurahr avatar Mar 28 '22 14:03 miurahr

I run an integration test with #211 configuration.

miurahr avatar Mar 29 '22 04:03 miurahr

OmegaT respect repository URL specified when first download, and override remote omegat.project mapping for root.

miurahr avatar Mar 29 '22 05:03 miurahr

@zephyrus00jp could you see and test it?

miurahr avatar Mar 29 '22 05:03 miurahr

PR #220 improve integration test to handle a case that this PR try to solve, that is mapping configuration in team project. I've also update #211 an integration helper handle a mapping.

miurahr avatar Mar 30 '22 05:03 miurahr

On 2022/03/29 14:49, Hiroshi Miura wrote:

@zephyrus00jp https://github.com/zephyrus00jp could you see and test it?

— Reply to this email directly, view it on GitHub https://github.com/omegat-org/omegat/pull/210#issuecomment-1081430465, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUNALELORFHT6AQ3NCI45LVCKKYLANCNFSM5PL6ZFVA. You are receiving this because you were mentioned.Message ID: @.***>

Sorry, I have had a hardware issue for about a month which has finally been solved since last week, and I am trying to catch up with backlog. I will try to look into the suggested change, etc. this week. (Except that I am afraid that I caught cold due to cold days over the weekend ...)

Chiaki

zephyrus00jp avatar Apr 04 '22 01:04 zephyrus00jp

Thanks @zephyrus00jp to take a look at here. IMHO, there is still a space to be able to improved;

  1. There are comments that express "how", but it should explain a policy "what and why".
  2. There is not enough to test the code we changed. I think Pull-Request #220 will help for it.

miurahr avatar Apr 04 '22 06:04 miurahr

Re-based on master again. Now you can test a repository mapping behavior with integration-test.

miurahr avatar Apr 09 '22 09:04 miurahr

Integration test is passed for duration 40min.

miurahr avatar Apr 09 '22 10:04 miurahr

@zephyrus00jp any comment?

miurahr avatar Jul 06 '22 23:07 miurahr

@zephyrus00jp ping

miurahr avatar Aug 04 '22 22:08 miurahr

When use the proposed change on new created fresh project, it show annoying warning dialog that say "Remote project file lacks git setting. This may be intentional, but likely an oversight." which is TF_REMOTE_PROJECT_LACKS_GIT_SETTING

org/omegat/gui/main/ProjectUICommands.java:508

                                if (props.getRepositories() == null) {
                                    Log.logWarningRB("TF_REMOTE_PROJECT_LACKS_GIT_SETTING");
                                    Core.getMainWindow().displayWarningRB("TF_REMOTE_PROJECT_LACKS_GIT_SETTING");
                                    props.setRepositories(repos); // restore the mapping we just lost
                                    needToSaveProperties = true;
                                } else {

That is added by commit "Changing the flow of updating teamwork omegat.project"( 9ff850e25571dd341c64d390591fe51eac9f ) where the previous is

                                if (props.getRepositories() == null) {  // We have a project without mappings
                                    props.setRepositories(repos); // so we restore the mapping we just lost
                                    needToSaveProperties = true;
                                }

@zephyrus00jp Why we need to show dialog here?

miurahr avatar Aug 13 '22 03:08 miurahr

merged as fad99d88d7ece47fc78a1ef27899492fe2778315

miurahr avatar Aug 21 '22 13:08 miurahr