Commit graph

21 commits

Author SHA1 Message Date
Félix Baylac-Jacqué 1030d83f26
h--tests-init-fake-git-repo: remove useless exit-code 2022-06-24 19:09:34 +02:00
Félix Baylac-Jacqué 82543d9e02
h--forge-fetchers-state: init all forges state to loading
We introduce the h--init-forges-state function in charge of
initializing the forge state and setting all the forges status to
loading. It prevents the forge names to gradually pop-up during a
forge request and instead display them with their appropriate status.
2022-06-21 08:55:26 +02:00
Félix Baylac-Jacqué af0940261c Make git subprocess async
The synchronous git process call was freezing the whole UI for a
*pretty long* time when checking out a big git repository.

We move into using a asynchronous process. This change required quite
a lot of sync-related changes. Both in the h.el codebase as well as in
the test suite.

On top of making the git call asynchronous, we also take advantage of
not freezing the UI anymore to open a window displaying the git clone
progress.
2022-06-20 21:32:31 +02:00
Félix Baylac-Jacqué 57eb402850
h--pick-relevant-forges: remove function
h--pick-relevant-forges is an artifact of a former architecture.

On top of being some useless code, it was brittle and was preventing
us from cloning a repository from savannah.
2022-06-16 21:00:30 +02:00
Félix Baylac-Jacqué a65c66ff66
forges: introduce Gitea support
We use the Gitea API to determine whether or not a given repo exists.
If it does, we use the API response to properly determine the SSH and
HTTPS clone URLs.
2022-06-16 18:59:45 +02:00
Félix Baylac-Jacqué ba8b3eb8ca
h--draw-ui-buffer: refactor, debug & write tests
We refactor h--draw-ui-buffer by extracting the key binding generator
to its own function. Having it in its own pure function, we're now
able to write some tests for it.
2022-06-09 12:27:16 +02:00
Félix Baylac-Jacqué ae6931262f
Forge fetchers: remove forge-str from the alist
We rather index the alist using the string representation of the
forge: it saves us an extra alist member.
2022-06-09 12:27:16 +02:00
Félix Baylac-Jacqué 296b28ee4a
Storing forge query results in a proper state. 2022-06-09 12:25:56 +02:00
Félix Baylac-Jacqué 3aac15dbb0
h--parse-repo-identifier: actually parse the query string
This function used to only return the kind of the query string. This
is not sufficient to properly query the forges. On top of returning
the type of a query string, we want this function to actually parse
the query into a tagged union materialized as a astring.

We update the tests accordingly to this refactoring.
2022-05-19 11:57:31 +02:00
Félix Baylac-Jacqué 735e9f2206
Implement h--pick-relevant-forges. 2022-05-16 19:47:39 +02:00
Félix Baylac-Jacqué bc5e1b31ae Implement h--cal-git-clone-in-dir
This function is in charge of using a underlying git subprocess to
clone a remote repository locally.
2022-05-05 12:06:02 +02:00
Félix Baylac-Jacqué 08b1a44d8b
Implement h--filepath-from-clone-url.
This function is meant to find where we should checkout a new git repo
in the coderoot.
2022-05-04 20:07:00 +02:00
Félix Baylac-Jacqué db74a5794a
Implement h--parse-repo-identifier
This function is meant to identify what kind of repo a user is giving
to us.
2022-05-04 20:04:20 +02:00
Félix Baylac-Jacqué 8eac693ceb
Github fetcher: parse actual request, handle errors 2022-04-08 16:31:19 +02:00
Félix Baylac-Jacqué 09c5099488
Github fetcher: implement response parser 2022-04-07 11:58:07 +02:00
Félix Baylac-Jacqué d07c1896fb
Implement custom recursive dir walker
We implement a custom replacement for `directory-files-recursively`
for x reasons:

1. `directory-files-recursively` has been introduced in Emacs 25.1.
    Meaning, as it was, h.el couldn't run on a older Emacs.
2. Specializing the code allows us to simplify quite a lot
   `directory-files-recursively`. Removing some unnecessary I/O
   operations. That's a win performance-wise.
3. We add the git repository detection routine directly into the dir
   walker. It reduces the walker complexity from O(2n) to O(n).
2022-04-06 19:29:31 +02:00
Félix Baylac-Jacqué 168345712b
lint: format comments as prescribed by the emacs manual 2022-04-04 17:31:26 +02:00
Félix Baylac-Jacqué b32b68f2af
h--get-code-root-projects: test more corner cases
Fix the code for the case where the h-code-root directory hasn't been
created yet.
2022-04-03 17:53:36 +02:00
Félix Baylac-Jacqué 0abe2e0956
h-tests: add basic infrastructure to create dummy code-root setup
So far, I was hoping I could check-in some dummy code-root setups
directly to the git repository as fixtures. Sadly, it's almost
impossible to check-in git repos in a git repo. The only option do to
so would be to setup git subrepo. Needless to say, I *really* don't
want to go down that path.

Instead, I created some infrastructure to create a temp directory in
which we generate the test code-roots on the fly.
2022-04-02 11:56:24 +02:00
Félix Baylac-Jacqué 02109cec18
get-code-root-projects: implement "naive" version
This function is meant to retrieve the projects repositories from the
code-root.

This first version is a bit naive in its approach: we consider a
directory to be a git repository as soon as a .git directory is present.

That might be a bit too naive.
2022-04-01 20:04:09 +02:00
Félix Baylac-Jacqué ea6631f05a
Burocratic setup 2022-04-01 10:44:44 +02:00