Commit Graph

104 Commits

Author SHA1 Message Date
Félix Baylac-Jacqué 8c86c9ae7c
README: document what this project is about 2022-06-24 18:05:53 +02:00
Félix Baylac-Jacqué 2f18545014
h--git-clone-from-forge-result: jump to dir after clone 2022-06-23 09:35:12 +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é 24596ca098
h-forge-fetchers: add Codeberg.org to the default forge fetchers 2022-06-16 19:04:05 +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é 95eac63fe9
h-forge-fetchers: add git.sr.ht to the default fetchers 2022-06-16 17:27:56 +02:00
Félix Baylac-Jacqué 56d72da827
sourcehut-fetcher: introduce sourcehut fetcher
We had to cut some corners for this one. See the function docstring for more
informations.
2022-06-16 17:27:04 +02:00
Félix Baylac-Jacqué 82db6ebb83
h-forge-fetchers: add Gitlab.com fetcher to the defaults 2022-06-16 17:02:29 +02:00
Félix Baylac-Jacqué 31343e66cb
gitlab-fetcher: introduce gitlab generic fetcher.
We introduce an instance-agnostic Gitlab fetcher.

As noted in the function docstring, there's no way to retrieve the
clone URLs from an API at the moment. We fall back to a somehow dirty
hack to get the job done.
2022-06-16 16:45:45 +02:00
Félix Baylac-Jacqué cdd2e84582
h-jump-to-project: Improve doc 2022-06-16 09:06:53 +02:00
Félix Baylac-Jacqué 4df46e2440
UI buffer: make it pretty.
Add some instructions to the UI to guide the user through the clone
process.

Killing the buffer once we're done with it all well.
2022-06-14 12:02:18 +02:00
Félix Baylac-Jacqué b127a20b98
evil-mode: setup key bindings for evil-mode
Adding the UI key bindings for evil mode. We make sure everything
still works without evil-mode as well.
2022-06-14 10:49:58 +02:00
Félix Baylac-Jacqué 4362074484
h-jump-to-project: clone project if not available in the code root.
We introduce a new autocomplete function to help us determine whether
the user-query was already in the collection of the completing read
call or whether this is a user-specified value.

We then take advantage of this function to make a single entry point
for the whole plugin: h-jump-to-project. This function now not only
allow a user to jump to a local project but also clones a missing
project from the available forge sources.
2022-06-14 09:52:34 +02:00
Félix Baylac-Jacqué ab2431b750
h-clone-project: full url clone
When the user queries a full git URL, directly clone the said URL
instead of querying the upstream forges.
2022-06-10 14:33:11 +02:00
Félix Baylac-Jacqué d3b80e7a51
h--clone-from-forge-result: add https fallback
If for some reason we can't clone a repository using ssh, we want to
fallback to HTTPS.
2022-06-10 11:26:24 +02:00
Ninjatrappeur 83fd82d62f
Merge pull request #1 from NinjaTrappeur/nin/fetchers 2022-06-09 16:19:56 +02:00
Félix Baylac-Jacqué e0710bf46a
h-checkout-project: add download repo key binding.
For now, we're only using the ssh checkout link. We're finally able to
check out a remote repository.

🎉 We're feature complete!!!!!! 🎉

Time to shave some Yaks now and make the thing pretty and robust.
2022-06-09 16:14:31 +02:00
Félix Baylac-Jacqué d4afd87804
Dropping support for emacs 25 :(
We rely on mutexes, which have sadly been introduced to emacs 26.
There's sadly no way to make h.el work without those.

Dropping support for emacs 25.
2022-06-09 12:35:42 +02:00
Félix Baylac-Jacqué 97084e560f
Commenting WIP work to fix the CI 2022-06-09 12:32:42 +02:00
Félix Baylac-Jacqué 2a5021274e
Forge fetchers: reorganizing code. 2022-06-09 12:27:16 +02:00
Félix Baylac-Jacqué 436f6efcc8
h--forge-fetchers-state: make it concurrent-proof.
We're concurrently querying several forges and accumulate these
queries results in a single state. We need to protect that state from
concurrent writes. Introducing a mutex in charge of protecting these
concurrent writes.
2022-06-09 12:27:16 +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é a6ee8de70a h-draw-ui-buffer: implement drawing buffer
This function is in charge of drawing the remote forge fetching UI. It
does display the status for each forge w/ colors and binds the
necessary key bindings in the said buffer.

We set the key binding from 1-9 then from a-z.
2022-05-09 20:02:37 +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é e7d04c4e27
Implement dummy gitea and gitlab fetchers 2022-05-04 20:02:27 +02:00
Félix Baylac-Jacqué ce62de0bc2
h--query-github: implement proper query mechanism 2022-04-08 17:24:23 +02:00
Félix Baylac-Jacqué 334cb578c9
ci: remove duplicate 25x runs 2022-04-08 16:33:00 +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é 6bc5b53fb2
Github fetcher: use json.el for backward-compatibility sake 2022-04-07 12:20:25 +02:00
Félix Baylac-Jacqué 09c5099488
Github fetcher: implement response parser 2022-04-07 11:58:07 +02:00
Félix Baylac-Jacqué 78cd7553d2
h.el: re-order main file structure 2022-04-07 11:10:37 +02:00
Félix Baylac-Jacqué 0651f5d761
CI: add Emacs 28.1 2022-04-06 19:54:31 +02:00
Félix Baylac-Jacqué 471763fe23
h--get-code-root-projects: drop directory-files-recursively
Use the newly implemented h--find-git-dirs-recursively tree walker
instead.

Support Emacs till 25.1 (released ~6 years ago).
2022-04-06 19:52:42 +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é 98bd39496f
h.el: documentation nits 2022-04-05 10:07:30 +02:00
Félix Baylac-Jacqué 384b952611
Update readme 2022-04-04 18:31:59 +02:00
Félix Baylac-Jacqué bac502397d
ci: fix ert call 2022-04-04 18:25:46 +02:00
Félix Baylac-Jacqué bc30dfa02f
h-jump-to-project: implement local project jump
Open a fuzzy-autocomplete mini-buffer to retrieve a project contained
in code-root. Once selected, open the said project folder.

First project milestone reached \0/
2022-04-04 18:02:28 +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é e9a208c3bb
string-remove-prefix: fix compilation error
string-remove-prefix is automatically available when evaluating the
source code, it's not the case when we compile it. Let's require its
library (subr-x) when compiling the list code.
2022-04-04 17:28:27 +02:00
Félix Baylac-Jacqué 24490140f3
Readme: add CI badge 2022-04-03 18:06:24 +02:00
Ninjatrappeur 556c687a0a
Setup CI 2022-04-03 18:03:25 +02:00