Commit Graph

198 Commits

Author SHA1 Message Date
Michael Muré
5511c230b6
move {bug,identity} to /entities, move input to /commands 2022-08-18 23:44:06 +02:00
Michael Muré
3d454d9dc8
entity/dag: proper base operation for simplified implementation
- reduce boilerplace necessary to implement an operation
- consolidate what an operation is in the core, which in turn pave the way for a generic cache layer mechanism
- avoid the previously complex unmarshalling process
- support operation metadata from the core
- simplified testing
2022-07-25 13:27:17 +02:00
Steve Moyer
1d4667c825
refactor(809): eliminate need to defer CleanupTestRepos() 2022-06-16 09:02:52 -04:00
Michael Muré
7348fb9edb
github: fix data race when closing event channel
I believe the issue was twofold:

When done importing, the calling context is likely still valid, so if the output channel is not read enough and reach capacity, some event producer down the line can be blocked trying to send in that channel. When closing it, this send is still trying to proceed, which is illegal in go.

In rateLimitHandlerClient, there was a need to 2 different type of output channel: core.ExportResult and ImportEvent. To do so, the previous code was using a single channel type RateLimitingEvent and a series of goroutines to read/cast/send to the final channel. This could result in more async goroutine being stuck trying to send in an at-capacity channel. Instead, the code now use a simple synchronous callback to directly push to the final output channel. No concurrency needed anymore and the code is simpler.

Any of those fixes could have resolved the data race, but both fixes is more correct.
2022-06-05 15:13:49 +02:00
Michael Muré
cadbccb533
Merge pull request #727 from MichaelMure/rng-dynamics/fix-import-empty-title
Fix: github import, some issue titles cause error
2021-12-04 12:29:24 +01:00
Alexander Scharinger
160ba2420b Fix: github import, some issue titles cause error 2021-12-04 09:50:24 +01:00
Alexander Scharinger
476526ac2b Fix: github bridge: push then pull without duplication 2021-12-03 23:21:11 +01:00
rng-dynamics
d546cdeee1
Tests for the github bridge (#706)
Add integration test for github bridge
2021-09-14 22:24:34 +02:00
rng-dynamics
247e1a865d
feature: Github bridge mutation rate limit (#694)
Unified handling of rate limiting of github graphql api
2021-09-14 22:22:28 +02:00
Sascha
1939949fcd
CLI: Add non-interactive option to interactive commands (#651)
* Add option to skip the AvatarURL input request

Using an empty string for the avatar cli flag e.g. `git-bug user create
-a ""` will still result in a prompt. As the avatar URL is an optional
option, it should be possible to skip asking for it entirely.
Otherwise automated user creation via a script must make use of pipe hacks.

* Add global --non-interactive cmdline option

* Replace --skipAvatar for --non-interactive option

* Cmd BugAdd: respect non-interactive option

* Cmd bridge configure: respect non-interactive opt

* Cmd CommentAdd: respect non-interactive option

* Cmd CommentEdit: respect non-interactive option

* Cmd TermUI: respect non-interactive option

* Cmd TitleEdit: respect non-interactive option

* Remove global non-interactive option

* Cmd UserCreate: Use local non-interactive option

* Cmd BugAdd: Use local non-interactive option

* Cmd BridgeConfigure: Use local non-interactive option

* Cmd CommentAdd: Use local non-interactive option

* Cmd CommentEdit: Use local non-interactive option

* Cmd TermUI: Drop non-interactive option

It should be obviouse that the termui is an interactive command.

* Cmd TitleEdit: Use local non-interactive option

* Update docs

* Bridge GitHub: respect non-interactive option

* Bridge GitLab: respect non-interactive option

* Bridge Jira: respect non-interactive and token opt

* Fix failing compilation

* Bridge launchpad: respect non-interactive option

* bridge: isNonInteractive --> interactive

Co-authored-by: Michael Muré <batolettre@gmail.com>
2021-05-09 11:14:45 +02:00
Michael Muré
7a7a402649
github: attempt to fix a CI issue 2021-04-23 00:28:46 +02:00
Ellis Clayton
a80152890c
Support new GitHub token formats
GitHub have introduced a new format for their access tokens, which does
not fit within the rules of the previous regex. For the time being, the
previous token format is still being supported by GitHub, so it makes
sense to continue allowing legacy tokens.

https://github.blog/changelog/2021-03-04-authentication-token-format-updates/
2021-04-19 10:21:11 +10:00
Michael Muré
51a2c85954
make sure every text input is safe and validated
fix #630
2021-04-17 17:40:11 +02:00
Alexander Scharinger
8fb6ea0d95 Github brdige: move credential loading and client creation back
Reason: failing integration tests
2021-04-09 15:56:32 +02:00
Michael Muré
10a80f1888
github: minor cleanups 2021-04-09 13:07:45 +02:00
Michael Muré
1520f678f7
Merge remote-tracking branch 'origin/master' into dev-gh-bridge 2021-04-09 13:01:14 +02:00
Alexander Scharinger
0fd570171d Improve feedback for user when Github rate limiting
The Github bridge itself should not write anything. This commit removes
code writing to stdout and itroduces an event `ImportEventRateLimiting`
to `core.ImportResult` in order to inform about a rate limiting situation
of the Github GraphQL API. Now the communication with the user is
delegated to the various user interfaces.
2021-04-08 23:57:25 +02:00
Alexander Scharinger
ede5e218ac Add comment to clarify look ahead in import channel 2021-04-08 23:20:05 +02:00
Alexander Scharinger
b2e98ef07f Github bridge: refactor message handling 2021-03-28 12:16:13 +02:00
Alexander Scharinger
db57227ae5 Github bridge: stop sleep-timer on SIGINT 2021-03-27 22:55:47 +01:00
Alexander Scharinger
21b330dad1 Github bridge: fix message about timeout 2021-03-27 22:45:49 +01:00
Alexander Scharinger
2646c63213 Github bridge: Refactor 2021-03-22 19:26:59 +01:00
Alexander Scharinger
52fba350d6 Github bridge: send message to user when waiting
When the Github GraphQL API rate limit is exhausted print a message at
the bottom of the terminal so the user knows why the import has been
paused.
2021-03-18 20:59:53 +01:00
Alexander Scharinger
d7f555b437 Github bridge: try again in case of web API error 2021-03-15 08:39:08 +01:00
Alexander Scharinger
93b14c509b Remove maps containing channels.
The old implementation of the github bridge used maps to store several
channels holding data obtained from the Github API. Removing the maps and
simply packing data and channels together in a struct and passing it
through one single channel makes the program simpler in terms of
concurrency and, additionally, enables the garbage collector to free the
memory gradually without any additional provisions.
2021-03-15 07:15:00 +01:00
Alexander Scharinger
9a8e487613 Fix errors: deadlock and empty titles 2021-03-15 07:14:40 +01:00
Alexander Scharinger
689b640bbb Deal with github bridge import rate limit 2021-02-28 21:03:10 +01:00
Michael Muré
3f6ef50883
bug: migrate to the DAG entity structure! 2021-02-14 12:19:50 +01:00
Michael Muré
b01aa18d39
identity: PR fixes 2021-02-14 12:17:47 +01:00
Michael Muré
ab57d74a31
deal with the previous changes 2021-02-14 12:17:47 +01:00
Michael Muré
1871f09345
Merge pull request #534 from MichaelMure/gh-bridge-pull-fix
Fix github bridge import
2021-02-01 11:46:31 +01:00
Alexander Scharinger
1ccbf2cb63 Add comments 2021-01-28 14:42:20 +01:00
Alexander Scharinger
62bcfd985d Fix bug 2021-01-26 12:07:26 +01:00
Alexander Scharinger
2d6f34acad Integrate new Github Bridge import 2021-01-24 21:37:44 +01:00
Alexander Scharinger
2c0cf10527 Add GraphQL github-bridge query for comment edits 2021-01-24 21:31:35 +01:00
Alexander Scharinger
955c6fa7d4 Add GraphQL github timeline query and iterator 2021-01-24 21:31:27 +01:00
Alexander Scharinger
799341baf2 Add issue edit iterator 2021-01-24 21:31:15 +01:00
Alexander Scharinger
824cefd2eb Add issue iterator 2021-01-24 21:31:05 +01:00
Alexander Scharinger
d08f01c8c3 Add GraphQL github issue query 2021-01-24 21:30:44 +01:00
Alexander Scharinger
0baf65cd64 WIP: Pinpoint some of the reasons for bug #385
Work in progress. The github bridge contains a bug documented in issue #385.
This commit shows what is the problem. There might be more problems. I have
changed the GraphQL query for timeline items and there are much less wrong
imports now. (Are there any malformed imports left?) I would like to rework the
entire bridge/github/iterator in the near future in order to create a reliable
fix for this bug.
2020-12-12 23:57:46 +01:00
Michael Muré
52ef5e96f5
add github actions 2020-12-08 15:03:56 +01:00
Michael Muré
9daa8ad04d
github: minor cleanups 2020-11-22 14:04:47 +01:00
Alexander Scharinger
eded1f10c4 Change return type from map to struct 2020-11-18 09:18:32 +01:00
rng-dynamics
09a845855f Apply suggestions from code review
Co-authored-by: Michael Muré <batolettre@gmail.com>
2020-11-18 09:18:32 +01:00
Alexander Scharinger
1b889a9198 Revision of Github bridge device authorization grant 2020-11-18 09:18:32 +01:00
Alexander Scharinger
dfa3a6d849 Replace Github authorization endpoint by device authorization grant
Fix issue #484
2020-11-18 09:18:32 +01:00
Michael Muré
1a0c86a12d
repo: use go-git in more places, fix push 2020-10-04 19:56:16 +02:00
Michael Muré
3ecbf8db28 bridge: store credentials in the Keyring instead of the git config 2020-09-29 20:42:21 +02:00
Michael Muré
88ad7e606f
repository: remove tie to Bug, improved and reusable testing
- allow the creation of arbitrary Lamport clocks, freeing the way to new entities and removing Bug specific (upper layer) code.
- generalize the memory-only and persisted Lamport clocks behind a common interface
- rework the tests to provide reusable testing code for a Repo, a Clock, a Config, opening a path to add a new Repo implementation more easily
- test previously untested components with those new tests

Note: one problem found during this endeavor is that `identity.Version` also need to store one time + Lamport time for each other Entity (Bug, config, PR ...). This could possibly done without breaking change but it would be much easier to wait for https://github.com/MichaelMure/git-bug-migration to happen.
2020-06-26 19:14:22 +02:00
Michael Muré
aab3a04d0c
bug: harmonize how time are used, fix some issues in command special formats
This assume that the convertion from time.Time <--> Unix timestamp is lossless which seems to be.
2020-06-25 23:18:17 +02:00