changeset 299:3e27514d575c

Use a reverse lookup in authormap to determine the author for 'hg svn info'. We don't use util.shortuser(); it breaks stuff by cropping the user name at the first period even if it's part of the name.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 27 Mar 2009 02:59:42 +0100
parents 32d3f1716e66
children 4aba7542f6a9
files hg_delta_editor.py utility_commands.py
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hg_delta_editor.py
+++ b/hg_delta_editor.py
@@ -692,6 +692,14 @@ class HgChangeReceiver(delta.Editor):
             return self.authors[author]
         return '%s%s' %(author, self.author_host)
 
+    def svnauthorforauthor(self, author):
+        for svnauthor, hgauthor in self.authors.iteritems():
+            if author == hgauthor:
+                return svnauthor
+        else:
+            # Mercurial incorrectly splits at e.g. '.', so we roll our own.
+            return author.rsplit('@', 1)[0]
+
     def readauthors(self, authorfile):
         self.ui.note(('Reading authormap from %s\n') % authorfile)
         f = open(authorfile, 'r')
--- a/utility_commands.py
+++ b/utility_commands.py
@@ -85,7 +85,7 @@ def run_svn_info(ui, repo, hg_repo_path,
     if url[-1] == '/':
         url = url[:-1]
     url = '%s%s' % (url, branchpath)
-    author = '@'.join(parent.user().split('@')[:-1])
+    author = hge.svnauthorforauthor(parent.user())
     # cleverly figure out repo root w/o actually contacting the server
     reporoot = url[:len(url)-len(subdir)]
     ui.status('''URL: %(url)s