comparison hgext/convert/hg.py @ 10282:08a0f04b56bd

many, many trivial check-code fixups
author Matt Mackall <mpm@selenic.com>
date Mon, 25 Jan 2010 00:05:27 -0600
parents 25e572394f5c
children 02d6149a480b
comparison
equal deleted inserted replaced
10281:e7d3b509af8b 10282:08a0f04b56bd
72 def authorfile(self): 72 def authorfile(self):
73 return os.path.join(self.path, ".hg", "authormap") 73 return os.path.join(self.path, ".hg", "authormap")
74 74
75 def getheads(self): 75 def getheads(self):
76 h = self.repo.changelog.heads() 76 h = self.repo.changelog.heads()
77 return [ hex(x) for x in h ] 77 return [hex(x) for x in h]
78 78
79 def setbranch(self, branch, pbranches): 79 def setbranch(self, branch, pbranches):
80 if not self.clonebranches: 80 if not self.clonebranches:
81 return 81 return
82 82
145 nparents = len(parents) 145 nparents = len(parents)
146 if self.filemapmode and nparents == 1: 146 if self.filemapmode and nparents == 1:
147 m1node = self.repo.changelog.read(bin(parents[0]))[0] 147 m1node = self.repo.changelog.read(bin(parents[0]))[0]
148 parent = parents[0] 148 parent = parents[0]
149 149
150 if len(parents) < 2: parents.append(nullid) 150 if len(parents) < 2:
151 if len(parents) < 2: parents.append(nullid) 151 parents.append(nullid)
152 if len(parents) < 2:
153 parents.append(nullid)
152 p2 = parents.pop(0) 154 p2 = parents.pop(0)
153 155
154 text = commit.desc 156 text = commit.desc
155 extra = commit.extra.copy() 157 extra = commit.extra.copy()
156 if self.branchnames and commit.branch: 158 if self.branchnames and commit.branch:
159 extra['convert_revision'] = commit.rev 161 extra['convert_revision'] = commit.rev
160 162
161 while parents: 163 while parents:
162 p1 = p2 164 p1 = p2
163 p2 = parents.pop(0) 165 p2 = parents.pop(0)
164 ctx = context.memctx(self.repo, (p1, p2), text, files.keys(), getfilectx, 166 ctx = context.memctx(self.repo, (p1, p2), text, files.keys(),
165 commit.author, commit.date, extra) 167 getfilectx, commit.author, commit.date, extra)
166 self.repo.commitctx(ctx) 168 self.repo.commitctx(ctx)
167 text = "(octopus merge fixup)\n" 169 text = "(octopus merge fixup)\n"
168 p2 = hex(self.repo.changelog.tip()) 170 p2 = hex(self.repo.changelog.tip())
169 171
170 if self.filemapmode and nparents == 1: 172 if self.filemapmode and nparents == 1: