review: Use a function to compute current user.

(imported from commit 9647650fad4015beb991983e06086ffb05f95180)
This commit is contained in:
Tim Abbott 2012-11-05 13:30:07 -05:00
parent 850e70c592
commit a9da4d2a72
1 changed files with 6 additions and 4 deletions

View File

@ -132,9 +132,12 @@ def parse_revs(repo, opts, args):
return [repo.commit(c) for c in repo.git.rev_list('--reverse', *args).split()]
def make_header(repo, opts, revs):
def get_current_user(repo):
ident = unicode(repo.git.var('GIT_AUTHOR_IDENT'), 'utf-8', 'replace')
me = ident[:ident.rindex('>') + 1]
return ident[:ident.rindex('>') + 1]
def make_header(repo, opts, revs):
me = get_current_user(repo)
reponame = get_reponame(repo)
remote = get_default_remote(repo)
@ -160,8 +163,7 @@ def make_header(repo, opts, revs):
def write_template(target, repo, opts):
ident = unicode(repo.git.var('GIT_AUTHOR_IDENT'), 'utf-8', 'replace')
me = ident[:ident.rindex('>') + 1]
me = get_current_user(repo)
print >>target, 'Dear %s,' % ", ".join(opts.reviewers)
print >>target