comparison hgext/convert/hg.py @ 6762:f67d1468ac50

util: add sort helper
author Matt Mackall <mpm@selenic.com>
date Fri, 27 Jun 2008 18:28:45 -0500
parents 51b0e799352f
children 6e253aa04ff7
comparison
equal deleted inserted replaced
6761:cb981fc955fb 6762:f67d1468ac50
162 except RepoError, inst: 162 except RepoError, inst:
163 parentctx = None 163 parentctx = None
164 tagparent = nullid 164 tagparent = nullid
165 165
166 try: 166 try:
167 old = parentctx.filectx(".hgtags").data() 167 oldlines = util.sort(parentctx['.hgtags'].data().splitlines(1))
168 oldlines = old.splitlines(1)
169 oldlines.sort()
170 except: 168 except:
171 oldlines = [] 169 oldlines = []
172 170
173 newlines = [("%s %s\n" % (tags[tag], tag)) for tag in tags.keys()] 171 newlines = util.sort([("%s %s\n" % (tags[tag], tag)) for tag in tags])
174 newlines.sort()
175 172
176 if newlines == oldlines: 173 if newlines == oldlines:
177 return None 174 return None
178 data = "".join(newlines) 175 data = "".join(newlines)
179 176
236 if self._changescache and self._changescache[0] == rev: 233 if self._changescache and self._changescache[0] == rev:
237 m, a, r = self._changescache[1] 234 m, a, r = self._changescache[1]
238 else: 235 else:
239 m, a, r = self.repo.status(ctx.parents()[0].node(), ctx.node())[:3] 236 m, a, r = self.repo.status(ctx.parents()[0].node(), ctx.node())[:3]
240 changes = [(name, rev) for name in m + a + r] 237 changes = [(name, rev) for name in m + a + r]
241 changes.sort() 238 return util.sort(changes), self.getcopies(ctx, m + a)
242 return (changes, self.getcopies(ctx, m + a))
243 239
244 def getcopies(self, ctx, files): 240 def getcopies(self, ctx, files):
245 copies = {} 241 copies = {}
246 for name in files: 242 for name in files:
247 try: 243 try: