def committer_from_author(author, options): """Get committer info based on options""" committer = GitModifier() if options.author_is_committer: committer.name = author.name committer.email = author.email return committer
def get_committer_from_author(author, options): """ Based on the options fill in the committer """ committer = GitModifier() if options.author_committer: committer.name = author.name committer.email = author.email if options.author_committer_date: committer.date = author.date return committer
def get_author(repo): """Determine author name and email""" author = GitModifier() if repo: author = repo.get_author_info() passwd_data = pwd.getpwuid(os.getuid()) if not author.name: # On some distros (Ubuntu, at least) the gecos field has it's own # internal structure of comma-separated fields author.name = passwd_data.pw_gecos.split(',')[0].strip() if not author.name: author.name = passwd_data.pw_name if not author.email: if 'EMAIL' in os.environ: author.email = os.environ['EMAIL'] else: author.email = "%s@%s" % (passwd_data.pw_name, socket.getfqdn()) return author