Skip to content

Commit 5ffdcca

Browse files
committed
v2.1.1 - bug fixes
1 parent 2c57d36 commit 5ffdcca

4 files changed

Lines changed: 41 additions & 23 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## 2.1.1 (2020-07-14)
4+
5+
* Fixed the long argument names which had underscores intead of hyphens
6+
* Fixed a bug where threads were not waiting at the end of the script before printing the completion message
7+
38
## 2.1.0 (2020-07-01)
49

510
* Replaced `requirements.txt` with `setup.py`

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
A powerful script to concurrently clone your entire GitHub instance or save it as an archive.
66

77
[![Build Status](https://travis-ci.com/Justintime50/github-archive.svg?branch=master)](https://travis-ci.com/Justintime50/github-archive)
8+
[![Pypi](https://img.shields.io/pypi/v/github-archive)](https://pypi.org/project/github-archive)
89
[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)
910

1011
<img src="assets/showcase.gif">

githubarchive/github_archive.py

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Import modules"""
2-
# pylint: disable=W0511,R0912,R0915
3-
# TODO: Restructure the code to align with what Pylint wants ^
2+
# pylint: disable=R0912,R0915
43
import os
54
from datetime import datetime
65
import sys
@@ -17,17 +16,17 @@ class Archive():
1716
parser = argparse.ArgumentParser(
1817
description='A powerful script to concurrently clone your entire' +
1918
'GitHub instance or save it as an archive.')
20-
parser.add_argument('-uc', '--user_clone', action='store_true',
19+
parser.add_argument('-uc', '--user-clone', action='store_true',
2120
help='Clone personal repos.')
22-
parser.add_argument('-up', '--user_pull', action='store_true',
21+
parser.add_argument('-up', '--user-pull', action='store_true',
2322
help='Pull personal repos')
24-
parser.add_argument('-gc', '--gists_clone', action='store_true',
23+
parser.add_argument('-gc', '--gists-clone', action='store_true',
2524
help='Clone personal gists')
26-
parser.add_argument('-gp', '--gists_pull', action='store_true',
25+
parser.add_argument('-gp', '--gists-pull', action='store_true',
2726
help='Pull personal gists.')
28-
parser.add_argument('-oc', '--orgs_clone', action='store_true',
27+
parser.add_argument('-oc', '--orgs-clone', action='store_true',
2928
help='Clone organization repos.')
30-
parser.add_argument('-op', '--orgs_pull', action='store_true',
29+
parser.add_argument('-op', '--orgs-pull', action='store_true',
3130
help='Pull organization repos.')
3231
parser.add_argument('-b', '--branch', default='master',
3332
help='Which branch to pull from.')
@@ -153,6 +152,7 @@ def main():
153152
preamble = f'{start_message}\n{start_time}\n'
154153
print(preamble)
155154
Archive.logs(preamble)
155+
thread_list = []
156156

157157
# Iterate over each personal repo and concurrently start cloning
158158
if Archive.args.user_clone is True:
@@ -164,8 +164,10 @@ def main():
164164
time.sleep(Archive.BUFFER)
165165
path = os.path.join(
166166
Archive.LOCATION, 'repos', repo.owner.login, repo.name)
167-
Thread(target=Archive.clone_repos, args=(
168-
repo, path,)).start()
167+
repo_thread = Thread(target=Archive.clone_repos, args=(
168+
repo, path,))
169+
thread_list.append(repo_thread)
170+
repo_thread.start()
169171
else:
170172
data = '## Skipping cloning user repos... ##'
171173
print(data)
@@ -181,8 +183,10 @@ def main():
181183
time.sleep(Archive.BUFFER)
182184
path = os.path.join(
183185
Archive.LOCATION, 'repos', repo.owner.login, repo.name)
184-
Thread(target=Archive.pull_repos, args=(
185-
repo, path,)).start()
186+
repo_thread = Thread(target=Archive.pull_repos, args=(
187+
repo, path,))
188+
thread_list.append(repo_thread)
189+
repo_thread.start()
186190
else:
187191
data = '## Skipping pulling user repos...## '
188192
print(data)
@@ -197,8 +201,10 @@ def main():
197201
time.sleep(Archive.BUFFER)
198202
path = os.path.join(
199203
Archive.LOCATION, 'gists', gist.id)
200-
Thread(target=Archive.clone_gists, args=(
201-
gist, path,)).start()
204+
repo_thread = Thread(target=Archive.clone_gists, args=(
205+
gist, path,))
206+
thread_list.append(repo_thread)
207+
repo_thread.start()
202208
else:
203209
data = '## Skipping cloning gists... ##'
204210
print(data)
@@ -213,8 +219,10 @@ def main():
213219
time.sleep(Archive.BUFFER)
214220
path = os.path.join(
215221
Archive.LOCATION, 'gists', gist.id)
216-
Thread(target=Archive.pull_gists, args=(
217-
gist, path,)).start()
222+
repo_thread = Thread(target=Archive.pull_gists, args=(
223+
gist, path,))
224+
thread_list.append(repo_thread)
225+
repo_thread.start()
218226
else:
219227
data = '## Skipping pulling gists... ##'
220228
print(data)
@@ -238,8 +246,10 @@ def main():
238246
time.sleep(Archive.BUFFER)
239247
path = os.path.join(
240248
Archive.LOCATION, 'repos', repo.owner.login, repo.name)
241-
Thread(target=Archive.clone_repos, args=(
242-
repo, path,)).start()
249+
repo_thread = Thread(target=Archive.clone_repos, args=(
250+
repo, path,))
251+
thread_list.append(repo_thread)
252+
repo_thread.start()
243253
else:
244254
data = '## Skipping cloning org repos... ##'
245255
print(data)
@@ -257,15 +267,17 @@ def main():
257267
time.sleep(Archive.BUFFER)
258268
path = os.path.join(
259269
Archive.LOCATION, 'repos', repo.owner.login, repo.name)
260-
Thread(target=Archive.pull_repos, args=(
261-
repo, path,)).start()
270+
repo_thread = Thread(target=Archive.pull_repos, args=(
271+
repo, path,))
272+
thread_list.append(repo_thread)
273+
repo_thread.start()
262274
else:
263275
data = '## Skipping pulling org repos... ##'
264276
print(data)
265277
Archive.logs(data)
266278

267-
# TODO: Use threading.wait to check if all processes are finished
268-
time.sleep(6)
279+
for thread in thread_list:
280+
thread.join()
269281
execution_time = f'Execution time: {datetime.now() - start_time}.'
270282
finish_message = f'GitHub Archive complete! {execution_time}'
271283
print(finish_message)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setuptools.setup(
1212
name='github-archive',
13-
version='2.1.0',
13+
version='2.1.1',
1414
description='A powerful script to concurrently clone your entire GitHub instance or save it as an archive.',
1515
long_description=long_description,
1616
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)