changeset 1375:abc87a62ff51

maps: remove python2.7ism from dynamic author mapping
author Mateusz Kwapich <mitrandir@fb.com>
date Mon, 08 Feb 2016 17:17:19 -0800
parents a17d8874a099
children e1619c051788
files hgsubversion/maps.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/maps.py
+++ b/hgsubversion/maps.py
@@ -103,8 +103,14 @@ class AuthorMap(dict):
         if search_author in self:
             result = self.super.__getitem__(search_author)
         elif self.meta.mapauthorscmd:
-            self[author] = result = subprocess.check_output (
-                self.meta.mapauthorscmd % author, shell = True).strip()
+            cmd = self.meta.mapauthorscmd % author
+            process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
+            output, err = process.communicate()
+            retcode = process.poll()
+            if retcode:
+                msg = 'map author command "%s" exited with error'
+                raise hgutil.Abort(msg % cmd)
+            self[author] = result = output.strip()
         if not result:
             if self.meta.defaultauthors:
                 self[author] = result = '%s%s' % (author, self.defaulthost)