-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Medium
-
None
-
Affects Version/s: None
-
Component/s: DVCS Accounts
Here is a description on how DVCS connector synchronises BB/GH commits with JIRA issue.
- Initially after linking new repository to JIRA we use BB/GH API to retrieve ALL commits in the repository.
- After this initial synchronisation connector does only INCREMENTAL synchronisation - it retrieves only changesets that were commited after the last synchronisation.
- To find out which changesets to retrieve, connector remembers the changeset with latest date and keeps the date in LAST_COMMIT_DATE variable. When doing incremental synchronisation we ask BB/GH api to return latest changesets and use only those where commit date of changeset is >= LAST_COMMIT_DATE.
This way if JIRA is down for some time, users can continue commiting. When JIRA goes back up, connector retrieves all the commits from latest up to LAST_COMMIT_DATE.
The problem with this approach is when users don't push their commits immediately:
- Let's say on Tuesday userA commits and pushes his commit
- DVCS Connector will catch and synchronise the commit and set LAST_COMMIT_DAY to Tuesday
- On Wednesday userB pushes his commit that was commited on Monday. The commit date for this commit is Monday.
- DVCS Connector will never synchronise the commit because commit date (Monday) < LAST_COMMIT_DATE
REST API differences
Bitbucket and GitHub APIs behave differently and different approaches will have to be used to fix it.
GitHub
GitHub API (https://api.github.com/repos/jirabitbucketconnector/missingcommits/commits) returns changesets ordered by commitDate. Changeset for each branch have to be retrieved separately.
Bitbucket
Bitbucket API (https://api.bitbucket.org/1.0/repositories/jirabitbucketconnector/missingcommits/changesets) returns changeset ordered by push date. All changesets from all branches are returned from same REST call.