comparison hgext/convert/git.py @ 8271:e3d3dad805f9

Add committer tag only when needed in git conversion Convert from a git repo added a committer: tag in the log message even if the committer and the author were the same person.
author Richard Quirk <richard.quirk@gmail.com>
date Fri, 01 May 2009 11:32:19 +0200
parents 1b60efdb8bc5
children e9e2a2c9b294
comparison
equal deleted inserted replaced
8270:3477ad0b1f2c 8271:e3d3dad805f9
88 end = c.find("\n\n") 88 end = c.find("\n\n")
89 message = c[end+2:] 89 message = c[end+2:]
90 message = self.recode(message) 90 message = self.recode(message)
91 l = c[:end].splitlines() 91 l = c[:end].splitlines()
92 parents = [] 92 parents = []
93 author = committer = None
93 for e in l[1:]: 94 for e in l[1:]:
94 n, v = e.split(" ", 1) 95 n, v = e.split(" ", 1)
95 if n == "author": 96 if n == "author":
96 p = v.split() 97 p = v.split()
97 tm, tz = p[-2:] 98 tm, tz = p[-2:]
102 p = v.split() 103 p = v.split()
103 tm, tz = p[-2:] 104 tm, tz = p[-2:]
104 committer = " ".join(p[:-2]) 105 committer = " ".join(p[:-2])
105 if committer[0] == "<": committer = committer[1:-1] 106 if committer[0] == "<": committer = committer[1:-1]
106 committer = self.recode(committer) 107 committer = self.recode(committer)
107 message += "\ncommitter: %s\n" % committer
108 if n == "parent": parents.append(v) 108 if n == "parent": parents.append(v)
109 109
110 if committer and committer != author:
111 message += "\ncommitter: %s\n" % committer
110 tzs, tzh, tzm = tz[-5:-4] + "1", tz[-4:-2], tz[-2:] 112 tzs, tzh, tzm = tz[-5:-4] + "1", tz[-4:-2], tz[-2:]
111 tz = -int(tzs) * (int(tzh) * 3600 + int(tzm)) 113 tz = -int(tzs) * (int(tzh) * 3600 + int(tzm))
112 date = tm + " " + str(tz) 114 date = tm + " " + str(tz)
113 115
114 c = commit(parents=parents, date=date, author=author, desc=message, 116 c = commit(parents=parents, date=date, author=author, desc=message,