Skip to content

Commit

Permalink
feat: clone functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lpmatos committed Jul 27, 2020
1 parent 432013c commit 31e2d35
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 53 deletions.
33 changes: 5 additions & 28 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
=================
gitlab-clone
gitlab-clone-recursive
=================


Expand All @@ -13,49 +13,26 @@ Tool for easy cloning whole gitlab structure to your local machine.
Requirements
------------

* Requests
* Python-GitLab
* Python >= 3.6


Installation
------------

You can install "gitlab-clone" via `pip`_::
You can install "gitlab-clone-recursive" via `pip`_::

$ pip install gitlab-clone
$ pip install gitlab-clone-recursive


Usage
-----


>>> gitlab-clone:
>>> gitlab-clone-recursive:
optional arguments:
-h, --help show this help message and exit
--group_id group_id Id of a group in gitlab
--token token Gitlab Token
--branch branch Branch to clone in all repos [by default master]
--gitlab-url gitlab Gitlab address [by default gitlab.com]


Example
-------

$ gitlab-clone --group=123 --token=MySecretToken --gitlab-url=gitlab.organization.com

For example if you clone this group https://gitlab.com/lmaolmaolmao which id is 6849299

you will have absolutely the same structure locally:

.. image:: https://github.com/ArseniyAntonov/gitlab-group-clone/raw/master/img/tree.png

>>> tree
.
└── lmaolmaolmao
└── subgroup1
└── subgroup2
└── subgroup3



.. _`pip`: https://pypi.python.org/pypi/pip/
1 change: 1 addition & 0 deletions gitlab-clone-recursive/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.0.1"
8 changes: 3 additions & 5 deletions gitlab-clone/cli.py → gitlab-clone-recursive/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import os
import sys
import re
Expand All @@ -9,9 +7,6 @@
import optparse
import subprocess

if __name__ != "__main__":
exit(1)

def pname():
pid = os.getpid()
return f"[gitlab-cloner - {str(pid)}]"
Expand Down Expand Up @@ -68,6 +63,9 @@ def main():

(options, args) = parser.parse_args()

clone(options)

def clone(options):
# TODO catch errrors
if not os.path.isdir(options.path):
sys.stderr.write("Error: destination path does not exist " + options.path + "\n")
Expand Down
1 change: 0 additions & 1 deletion gitlab-clone/__init__.py

This file was deleted.

15 changes: 0 additions & 15 deletions setup.cfg

This file was deleted.

8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from setuptools import setup, find_packages

with open('README.rst') as readme_file:
with open("README.rst") as readme_file:
readme = readme_file.read()

requirements = ['python-gitlab']
requirements = ["python-gitlab"]

setup(
author="Lucca Pessoa da Silva Matos",
Expand All @@ -20,10 +20,10 @@
name="gitlab-clone-recurisve",
packages=find_packages(include=["gitlab_clone_recursive"]),
url="https://github.com/lpmatos/gitlab-clone",
version="1.1",
version="1.2",
entry_points={
"console_scripts": [
"gitlab-clone-recursive=gitlab_clone_recursive.clonner:main",
"gitlab-clone-recursive=gitlab_clone_recursive.cli:main",
]
},
zip_safe=False,
Expand Down

0 comments on commit 31e2d35

Please sign in to comment.