forked from jsk-ros-pkg/jsk_common
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Depends on ros/rosdistro#13011
- Loading branch information
Showing
5 changed files
with
78 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
#!/usr/bin/env python | ||
|
||
# Generate commit aliases for jsk-ros-pkg developers | ||
"""Generate commit aliases for jsk-ros-pkg developers""" | ||
|
||
import subprocess | ||
from pygithub3 import Github | ||
from jsk_tools.github_lib import login_github | ||
|
||
|
||
from getpass import getpass | ||
user = raw_input('GitHub User name: ') | ||
pw = getpass('Password: ') | ||
|
||
gh = Github(login=user, password=pw) | ||
result = gh.orgs.members.list('jsk-ros-pkg') | ||
for page in result: | ||
for member in page: | ||
user = gh.users.get(member.login) | ||
def main(): | ||
gh = login_github() | ||
|
||
org = gh.get_organization('jsk-ros-pkg') | ||
for user in org.get_members(): | ||
try: | ||
name = user.name | ||
alias_name = name | ||
alias_name = name = user.name | ||
email = user.email | ||
if not email or email == "": | ||
raise Exception("No email specified") | ||
if len(alias_name.split(" ")) > 0: | ||
if len(name.split(" ")) > 0: | ||
alias_name = name.split(" ")[-1] | ||
alias_command = "commit-%s" % alias_name.lower() | ||
alias = "jsk-commit --author='%s <%s>'" % (name, email) | ||
subprocess.check_call(["git", "config", "--global", | ||
"alias.%s" % alias_command, | ||
alias]) | ||
subprocess.check_call( | ||
["git", "config", "--global", | ||
"alias.%s" % alias_command, alias] | ||
) | ||
print "Added %s" % (alias_command) | ||
except: | ||
print "Failed to generate alias for %s" % (member.login) | ||
except Exception as e: | ||
print("Failed to generate alias for %s: %s" % (user.name, e)) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
from . import video_directive | ||
from . import sanity_lib | ||
from . import cltool | ||
from . import github_lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import __builtin__ | ||
|
||
import getpass | ||
import sys | ||
|
||
import github | ||
|
||
|
||
def raw_input(prompt=None): | ||
if prompt: | ||
sys.stderr.write(str(prompt)) | ||
return __builtin__.raw_input() | ||
|
||
|
||
gh = None | ||
|
||
|
||
def login_github(): | ||
global gh | ||
if gh is None: | ||
username = raw_input('GitHub username: ') | ||
password = getpass.getpass('Password: ', stream=sys.stderr) | ||
gh = github.Github(username, password) | ||
return gh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python | ||
|
||
import argparse | ||
|
||
from jsk_tools.github_lib import login_github | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--rosinstall', action='store_true', | ||
help='Outputs with rosinstall format.') | ||
args = parser.parse_args() | ||
|
||
rosinstall = args.rosinstall | ||
|
||
gh = login_github() | ||
|
||
for org_name in ['jsk-ros-pkg', 'start-jsk']: | ||
org = gh.get_organization(org_name) | ||
for repo in org.get_repos(): | ||
if rosinstall: | ||
print('''\ | ||
- git: | ||
local-name: {repo.full_name} | ||
uri: https://github.com/{repo.full_name}.git | ||
version: {repo.default_branch}'''.format(repo=repo)) | ||
else: | ||
print(repo.full_name) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |