aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2014-07-03 23:08:40 +0200
committerMatěj Cepl <mcepl@cepl.eu>2024-03-01 00:51:47 +0100
commit135dac1e3f0c9a7f92b571a22595463960f2d535 (patch)
treeec71447f5cdd4c36d6793b80f3b64e82d828931b
parent89e3a836a9d4d9927c87cca3f49220a72f6a937c (diff)
downloadhlupak-135dac1e3f0c9a7f92b571a22595463960f2d535.tar.gz
fix(add-networked-repos): A bit cleanup
-rwxr-xr-xadd-networked-repos.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/add-networked-repos.py b/add-networked-repos.py
index 228ca2a..c5cb1eb 100755
--- a/add-networked-repos.py
+++ b/add-networked-repos.py
@@ -5,15 +5,16 @@ import json
import subprocess
import argparse
-URL="https://api.github.com/repos/%s/%s/forks"
+URL = "https://api.github.com/repos/%s/%s/forks"
REPO_URL = "https://github.com/%s/%s"
p = subprocess.Popen(['git', 'config', 'github.user'],
- stdout=subprocess.PIPE)
+ stdout=subprocess.PIPE)
login = p.communicate()[0].strip()
p = subprocess.Popen(['git', 'config', 'github.password'],
- stdout=subprocess.PIPE)
+ stdout=subprocess.PIPE)
passwd = p.communicate()[0].strip()
+
def get_forks(repo):
user, name = repo.split("/", 2)
@@ -21,20 +22,21 @@ def get_forks(repo):
password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
password_mgr.add_password(None, repo_url, login, passwd)
auth_handler = urllib2.HTTPBasicAuthHandler(password_mgr)
- opener=urllib2.build_opener(auth_handler)
+ opener = urllib2.build_opener(auth_handler)
urllib2.install_opener(opener)
response = urllib2.urlopen(repo_url)
repos = json.load(response)
for repo in repos:
full_name = repo['full_name']
f_user, f_name = full_name.split("/", 2)
- subprocess.call(['git','remote','add',f_user.lower(),
- REPO_URL % (f_user, f_name)])
+ subprocess.call(['git', 'remote', 'add', f_user.lower(),
+ REPO_URL % (f_user, f_name)])
+ subprocess.call(['git', 'fetch', f_user.lower()])
get_forks(full_name)
parser = argparse.ArgumentParser()
parser.add_argument('fname_repo',
- help="full name of the repo (e.g., user/name)")
+ help="full name of the repo (e.g., user/name)")
args = parser.parse_args()
get_forks(args.fname_repo)