Instead of parsing the output of "p4 users" use the python objects of "p4 -G users".
Signed-off-by: Simon Hausmann <hausmann@kde.org>maint
parent
f6148d9129
commit
a39811b46e
|
@ -38,18 +38,25 @@ except ValueError:
|
||||||
if not prefix.endswith("/"):
|
if not prefix.endswith("/"):
|
||||||
prefix += "/"
|
prefix += "/"
|
||||||
|
|
||||||
def p4Cmd(cmd):
|
def p4CmdList(cmd):
|
||||||
pipe = os.popen("p4 -G %s" % cmd, "rb")
|
pipe = os.popen("p4 -G %s" % cmd, "rb")
|
||||||
result = {}
|
result = []
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
entry = marshal.load(pipe)
|
entry = marshal.load(pipe)
|
||||||
result.update(entry)
|
result.append(entry)
|
||||||
except EOFError:
|
except EOFError:
|
||||||
pass
|
pass
|
||||||
pipe.close()
|
pipe.close()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def p4Cmd(cmd):
|
||||||
|
list = p4CmdList(cmd)
|
||||||
|
result = {}
|
||||||
|
for entry in list:
|
||||||
|
result.update(entry)
|
||||||
|
return result;
|
||||||
|
|
||||||
def describe(change):
|
def describe(change):
|
||||||
describeOutput = p4Cmd("describe %s" % change)
|
describeOutput = p4Cmd("describe %s" % change)
|
||||||
|
|
||||||
|
@ -94,18 +101,11 @@ def stripRevision(path):
|
||||||
|
|
||||||
def getUserMap():
|
def getUserMap():
|
||||||
users = {}
|
users = {}
|
||||||
output = os.popen("p4 users")
|
|
||||||
for line in output:
|
|
||||||
firstSpace = line.index(" ")
|
|
||||||
secondSpace = line.index(" ", firstSpace + 1)
|
|
||||||
key = line[:firstSpace]
|
|
||||||
email = line[firstSpace + 1:secondSpace]
|
|
||||||
openParenPos = line.index("(", secondSpace)
|
|
||||||
closedParenPos = line.index(")", openParenPos)
|
|
||||||
name = line[openParenPos + 1:closedParenPos]
|
|
||||||
|
|
||||||
users[key] = name + " " + email
|
|
||||||
|
|
||||||
|
for output in p4CmdList("users"):
|
||||||
|
if not output.has_key("User"):
|
||||||
|
continue
|
||||||
|
users[output["User"]] = output["FullName"] + " <" + output["Email"] + ">"
|
||||||
return users
|
return users
|
||||||
|
|
||||||
users = getUserMap()
|
users = getUserMap()
|
||||||
|
|
Loading…
Reference in New Issue