Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow analysis of remote repos #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

valeriocos
Copy link

@valeriocos valeriocos commented Feb 20, 2021

Hi @vitsalis, congrats for the tool! I thought that it could be useful to analyse remote repos. I made some changes to the tool, let me know what you think, thanks.

This PR proposes to change the input params to let run RepoFS on remote and local repositories. The tool requires an URI which targets the repo to process, two optional params can be used to define the local paths of the cloned repo and file system.

The new params are:

  • Uri, which points to the local/remote repo
  • Git-path (optional), which tells where the repo will be cloned locally. If null, the default root location is ~/.repofs/repositories
  • Mount-path (optional), which tells where the FS will be mounted. If null, the default root location is ~/.repofs/mounts

Examples of RepoFS calls from cmd are:

repofs https://github.com/org/repo
repofs /tmp/my-repo

When the tool is executed, the target repo is cloned only if it doesn't exist, otherwise pygit2 is used to pull all branches. The corresponding code added in the main() relies on https://github.com/MichaelBoselowitz/pygit2-examples/blob/master/examples.py#L54 (I didn't test it extensively).

The logic included in main has been moved to /bin/repofs for refactor purposes. IMHO, it's better to have the logic in charge of parsing and executing the tool in a separated folder.

The requirements.txt is included to test the tool as follows:

pip install -r requirements.txt -e .

README.md has been updated accordingly.

This code changes the input params to let run
RepoFS on remote repositories. The tool requires
an URI which targets the repo to process, two
optional params can be used to define the
local paths of the cloned repo and file system.

The new params are:
- Uri, which points to the local/remote repo
- Git-path (optional), which points where the repo
  will be cloned locally. If null, the default
  root location is ~/.repofs/repositories
- Mount-path (optional), which points where the FS will
  be mounted. If null, the default root location is
  ~/.repofs/mounts

An example of RepoFS call from cmd is:
```
repofs https://github.com/org/repo
```

When the tool is executed, the target repo is cloned
only if it doesn't exist, otherwise pygit2 is used
to pull all branches. The corresponding code added in
the main() relies on https://github.com/MichaelBoselowitz/pygit2-examples/blob/master/examples.py#L54.

The logic included in __main__ has been moved to /bin/repofs
for refactor purposes.

The requirements.txt is included to test the tool as
follows:
```
pip install -r requirements.txt -e .
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant