summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2013-05-24 21:29:56 -0500
committerJunio C Hamano <gitster@pobox.com>2013-05-28 08:02:05 -0700
commitd462469b4dd724b162a6ef29d0907eb133a5d56e (patch)
tree3cefcbdf9db44811eadddb9a17edea27d483002c /contrib
parentb688911a789e4eb1cfb97e1a59df0b14817b9d1a (diff)
downloadgit-d462469b4dd724b162a6ef29d0907eb133a5d56e.tar.gz
remote-hg: improve lightweight tag author
Use git's committer. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/remote-helpers/git-remote-hg18
1 files changed, 14 insertions, 4 deletions
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index a1b22f7c6c..fa76b3f610 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -840,13 +840,23 @@ def write_tag(repo, tag, node, msg, author):
p1 = tip.hex()
p2 = '0' * 40
- if not author:
- author = (None, 0, 0)
- user, date, tz = author
+ if author:
+ user, date, tz = author
+ date_tz = (date, tz)
+ else:
+ cmd = ['git', 'var', 'GIT_COMMITTER_IDENT']
+ process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ output, _ = process.communicate()
+ m = re.match('^.* <.*>', output)
+ if m:
+ user = m.group(0)
+ else:
+ user = repo.ui.username()
+ date_tz = None
ctx = context.memctx(repo, (p1, p2), msg,
['.hgtags'], getfilectx,
- user, (date, tz), {'branch' : branch})
+ user, date_tz, {'branch' : branch})
tmp = encoding.encoding
encoding.encoding = 'utf-8'