chaoss / grimoirelab-perceval

Send Sir Perceval on a quest to retrieve and gather data from software repositories.

Home Page:http://perceval.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Small Feature] Is there a way to decide path where the Git repositories will be cloned?

xiao623 opened this issue · comments

def _pre_init(self):
"""Initialize repositories directory path"""
if self.parsed_args.git_log:
git_path = self.parsed_args.git_log
elif not self.parsed_args.git_path:
base_path = os.path.expanduser('~/.perceval/repositories/')
processed_uri = self.parsed_args.uri.lstrip('/')
git_path = os.path.join(base_path, processed_uri) + '-git'
else:
git_path = self.parsed_args.git_path
setattr(self.parsed_args, 'gitpath', git_path)

The git_path would decide path where the Git repository will be cloned, but it just only for one repo.
If I have many repos, I must change git_path one by one and run the program again and agian.

Yes, I can use ~/.perceval/repositories/ for those repos and clone them, but sometimes I want to change the place where those repos have been cloned in advance. For example, those repos would be cloned in special place (e.g. my NAS) instead of local server's path.

[New Feature & Small Feature]

I think we can add a param repo-path for Git Perceval Backend so that we can decide path where the Git repositories will be cloned.

def _pre_init(self):
...
elif self.parsed_args.repo_path:
   base_path = self.parsed_args.repo_path
   processed_uri = self.parsed_args.uri.lstrip('/')
   git_path = os.path.join(base_path, processed_uri) + '-git'
elif not self.parsed_args.git_path: 
...

def setup_cmd_parser(cls):
...
  exgroup.add_argument('--repo-path', dest='repo_path',
                             help="Path where the Git repositories will be cloned")
  exgroup.add_argument('--git-path', dest='git_path',
...

Sounds good. Can you open a PR with this feature? I would like to have a better name for the option than repo-path if possible.