summaryrefslogtreecommitdiffstats
path: root/git-p4.py
diff options
context:
space:
mode:
authorLars Schneider <lars.schneider@autodesk.com>2016-03-01 11:49:56 +0100
committerJunio C Hamano <gitster@pobox.com>2016-03-15 11:45:13 -0700
commit10d08a149d2295a239ac7710d32c0b77492f61c3 (patch)
tree5901bdc77a12cfa7dbf09c76299cc77555e42b65 /git-p4.py
parentGit 2.7.3 (diff)
downloadgit-10d08a149d2295a239ac7710d32c0b77492f61c3.tar.xz
git-10d08a149d2295a239ac7710d32c0b77492f61c3.zip
git-p4: map a P4 user to Git author name and email address
Map a P4 user to a specific name and email address in Git with the "git-p4.mapUser" config. The config value must be a string adhering to the format "p4user = First Lastname <email@address.com>". Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/git-p4.py b/git-p4.py
index c33dece5d29..bac341d04c4 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1160,6 +1160,15 @@ class P4UserMap:
self.users[output["User"]] = output["FullName"] + " <" + output["Email"] + ">"
self.emails[output["Email"]] = output["User"]
+ mapUserConfigRegex = re.compile(r"^\s*(\S+)\s*=\s*(.+)\s*<(\S+)>\s*$", re.VERBOSE)
+ for mapUserConfig in gitConfigList("git-p4.mapUser"):
+ mapUser = mapUserConfigRegex.findall(mapUserConfig)
+ if mapUser and len(mapUser[0]) == 3:
+ user = mapUser[0][0]
+ fullname = mapUser[0][1]
+ email = mapUser[0][2]
+ self.users[user] = fullname + " <" + email + ">"
+ self.emails[email] = user
s = ''
for (key, val) in self.users.items():