unfoldingWord / gateway-translate

A tool for editing and translating text in USFM markup
MIT License
2 stars 3 forks source link

Add merge to gT #173

Open mandolyte opened 1 year ago

mandolyte commented 1 year ago

This is a gT concern, not an editor concern. But there are some interactions with the editor upon successful merging.

Swagger notes: This API: https://qa.door43.org/api/swagger#/repository/repoGetPullRequestFiles

used like this: https://qa.door43.org/api/v1/repos/unfoldingword/en_tn/pulls/3189/files

returns this:

[
  {
    "filename": "tn_TIT.tsv",
    "status": "changed",
    "additions": 7,
    "deletions": 13,
    "changes": 20,
    "html_url": "https://qa.door43.org/unfoldingWord/en_tn/src/commit/82ba83a294f96a5380e55ba828546304cff5486b/tn_TIT.tsv",
    "contents_url": "https://qa.door43.org/api/v1/repos/unfoldingWord/en_tn/contents/tn_TIT.tsv?ref=82ba83a294f96a5380e55ba828546304cff5486b",
    "raw_url": "https://qa.door43.org/unfoldingWord/en_tn/raw/commit/82ba83a294f96a5380e55ba828546304cff5486b/tn_TIT.tsv"
  }
]

It shows:

Now if I have updated via "update from master", then I think I'll need that commit SHA before and after in order to know if my file on screen is out of date.

If my file previously fetched is now out of date, then it needs to be re-fetched and I need a way to signal the editor that I have new content which should overwrite current content. Also need to consider whether user has unsaved changes.

mandolyte commented 1 year ago

Note: in the below, the term "update" and "merge" are used in the senses that Gitea uses them. That is, "update" means to update the user branch with updates from master; "merge" means to update master with changes in the user branch.

Case 1: unsaved data In this case the user must first save (or discard) any changes before attempting to update or merge.

Case 2: user branch does not exist In this case, the user has never saved any changes and does not have a user branch. Therefore, a PR cannot be created and neither update nor merge are able to work.

Case 3: run update check The PR will be created if it doesn't exist and the updatable status will be returned.

Case 4: run merge check The PR will be created if it doesn't exist and the mergeable status will be returned.