##// END OF EJS Templates
replace util.sort with sorted built-in...
Matt Mackall -
r8209:a1a5a57e default
parent child Browse files
Show More
@@ -169,7 +169,7 b' class bugzilla_2_16(object):'
169 169 def filter_real_bug_ids(self, ids):
170 170 '''filter not-existing bug ids from list.'''
171 171 self.run('select bug_id from bugs where bug_id in %s' % buglist(ids))
172 return util.sort([c[0] for c in self.cursor.fetchall()])
172 return sorted([c[0] for c in self.cursor.fetchall()])
173 173
174 174 def filter_unknown_bug_ids(self, node, ids):
175 175 '''filter bug ids from list that already refer to this changeset.'''
@@ -182,7 +182,7 b' class bugzilla_2_16(object):'
182 182 self.ui.status(_('bug %d already knows about changeset %s\n') %
183 183 (id, short(node)))
184 184 unknown.discard(id)
185 return util.sort(unknown)
185 return sorted(unknown)
186 186
187 187 def notify(self, ids, committer):
188 188 '''tell bugzilla to send mail.'''
@@ -347,7 +347,7 b' class convert_cvs(converter_source):'
347 347 def getchanges(self, rev):
348 348 self._parse()
349 349 self.modecache = {}
350 return util.sort(self.files[rev].items()), {}
350 return sorted(self.files[rev].iteritems()), {}
351 351
352 352 def getcommit(self, rev):
353 353 self._parse()
@@ -359,4 +359,4 b' class convert_cvs(converter_source):'
359 359
360 360 def getchangedfiles(self, rev, i):
361 361 self._parse()
362 return util.sort(self.files[rev].keys())
362 return sorted(self.files[rev])
@@ -383,7 +383,7 b' def createlog(ui, directory=None, root="'
383 383 if store:
384 384 # clean up the results and save in the log.
385 385 store = False
386 e.tags = util.sort([scache(x) for x in tags.get(e.revision, [])])
386 e.tags = sorted([scache(x) for x in tags.get(e.revision, [])])
387 387 e.comment = scache('\n'.join(e.comment))
388 388
389 389 revn = len(e.revision)
@@ -576,7 +576,7 b' def createchangeset(ui, log, fuzz=60, me'
576 576 for tag in e.tags:
577 577 tags[tag] = True
578 578 # remember tags only if this is the latest changeset to have it
579 c.tags = util.sort([tag for tag in tags if globaltags[tag] is c])
579 c.tags = sorted([tag for tag in tags if globaltags[tag] is c])
580 580
581 581 # Find parent changesets, handle {{mergetobranch BRANCHNAME}}
582 582 # by inserting dummy changesets with two parents, and handle
@@ -111,7 +111,7 b' class darcs_source(converter_source, com'
111 111 else:
112 112 changes.append((elt.text.strip(), rev))
113 113 self.lastrev = rev
114 return util.sort(changes), copies
114 return sorted(changes), copies
115 115
116 116 def getfile(self, name, rev):
117 117 if rev != self.lastrev:
@@ -168,7 +168,7 b' class gnuarch_source(converter_source, c'
168 168 copies.update(cps)
169 169
170 170 self.lastrev = rev
171 return util.sort(set(changes)), copies
171 return sorted(set(changes)), copies
172 172
173 173 def getcommit(self, rev):
174 174 changes = self.changes[rev]
@@ -163,11 +163,11 b' class mercurial_sink(converter_sink):'
163 163 tagparent = nullid
164 164
165 165 try:
166 oldlines = util.sort(parentctx['.hgtags'].data().splitlines(1))
166 oldlines = sorted(parentctx['.hgtags'].data().splitlines(1))
167 167 except:
168 168 oldlines = []
169 169
170 newlines = util.sort([("%s %s\n" % (tags[tag], tag)) for tag in tags])
170 newlines = sorted([("%s %s\n" % (tags[tag], tag)) for tag in tags])
171 171 if newlines == oldlines:
172 172 return None
173 173 data = "".join(newlines)
@@ -251,7 +251,7 b' class mercurial_source(converter_source)'
251 251 ctx = self.changectx(rev)
252 252 parents = self.parents(ctx)
253 253 if not parents:
254 files = util.sort(ctx.manifest().keys())
254 files = sorted(ctx.manifest())
255 255 if self.ignoreerrors:
256 256 # calling getcopies() is a simple way to detect missing
257 257 # revlogs and populate self.ignored
@@ -266,7 +266,7 b' class mercurial_source(converter_source)'
266 266 copies = self.getcopies(ctx, m + a)
267 267 changes = [(name, rev) for name in m + a + r
268 268 if name not in self.ignored]
269 return util.sort(changes), copies
269 return sorted(changes), copies
270 270
271 271 def getcopies(self, ctx, files):
272 272 copies = {}
@@ -176,4 +176,4 b' class p4_source(converter_source):'
176 176 return self.tags
177 177
178 178 def getchangedfiles(self, rev, i):
179 return util.sort([x[0] for x in self.files[rev]])
179 return sorted([x[0] for x in self.files[rev]])
@@ -712,7 +712,7 b' class svn_source(converter_source):'
712 712 # This will fail if a directory was copied
713 713 # from another branch and then some of its files
714 714 # were deleted in the same transaction.
715 children = util.sort(self._find_children(path, revnum))
715 children = sorted(self._find_children(path, revnum))
716 716 for child in children:
717 717 # Can we move a child directory and its
718 718 # parent in the same commit? (probably can). Could
@@ -779,7 +779,7 b' class svn_source(converter_source):'
779 779 parents = []
780 780 # check whether this revision is the start of a branch or part
781 781 # of a branch renaming
782 orig_paths = util.sort(orig_paths.items())
782 orig_paths = sorted(orig_paths.iteritems())
783 783 root_paths = [(p,e) for p,e in orig_paths if self.module.startswith(p)]
784 784 if root_paths:
785 785 path, ent = root_paths[-1]
@@ -1108,7 +1108,7 b' class svn_sink(converter_sink, commandli'
1108 1108 return dirs
1109 1109
1110 1110 def add_dirs(self, files):
1111 add_dirs = [d for d in util.sort(self.dirs_of(files))
1111 add_dirs = [d for d in sorted(self.dirs_of(files))
1112 1112 if not os.path.exists(self.wjoin(d, '.svn', 'entries'))]
1113 1113 if add_dirs:
1114 1114 self.xargs(add_dirs, 'add', non_recursive=True, quiet=True)
@@ -1120,10 +1120,8 b' class svn_sink(converter_sink, commandli'
1120 1120 return files
1121 1121
1122 1122 def tidy_dirs(self, names):
1123 dirs = util.sort(self.dirs_of(names))
1124 dirs.reverse()
1125 1123 deleted = []
1126 for d in dirs:
1124 for d in sorted(self.dirs_of(names), reverse=True):
1127 1125 wd = self.wjoin(d)
1128 1126 if os.listdir(wd) == '.svn':
1129 1127 self.run0('delete', d)
@@ -539,7 +539,7 b' class Watcher(object):'
539 539 self.ui.note(_('%s processing %d deferred events as %d\n') %
540 540 (self.event_time(), self.deferred,
541 541 len(self.eventq)))
542 for wpath, evts in util.sort(self.eventq.items()):
542 for wpath, evts in sorted(self.eventq.iteritems()):
543 543 for evt in evts:
544 544 self.deferred_event(wpath, evt)
545 545 self.eventq.clear()
@@ -377,7 +377,7 b' def files(ui, repo, *pats, **opts):'
377 377 kwt = kwtools['templater']
378 378 status = _status(ui, repo, kwt, opts.get('untracked'), *pats, **opts)
379 379 modified, added, removed, deleted, unknown, ignored, clean = status
380 files = util.sort(modified + added + clean + unknown)
380 files = sorted(modified + added + clean + unknown)
381 381 wctx = repo[None]
382 382 kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
383 383 cwd = pats and repo.getcwd() or ''
@@ -204,7 +204,7 b' class queue:'
204 204 bad = self.check_guard(guard)
205 205 if bad:
206 206 raise util.Abort(bad)
207 guards = util.sort(set(guards))
207 guards = sorted(set(guards))
208 208 self.ui.debug(_('active guards: %s\n') % ' '.join(guards))
209 209 self.active_guards = guards
210 210 self.guards_dirty = True
@@ -600,18 +600,16 b' class queue:'
600 600 return (err, n)
601 601
602 602 def _clean_series(self, patches):
603 indices = util.sort([self.find_series(p) for p in patches])
604 for i in indices[-1::-1]:
603 for i in sorted([self.find_series(p) for p in patches], reverse=True):
605 604 del self.full_series[i]
606 605 self.parse_series()
607 606 self.series_dirty = 1
608 607
609 608 def finish(self, repo, revs):
610 revs.sort()
611 609 firstrev = repo[self.applied[0].rev].rev()
612 610 appliedbase = 0
613 611 patches = []
614 for rev in util.sort(revs):
612 for rev in sorted(revs):
615 613 if rev < firstrev:
616 614 raise util.Abort(_('revision %d is not managed') % rev)
617 615 base = bin(self.applied[appliedbase].rev)
@@ -1367,7 +1365,7 b' class queue:'
1367 1365 self.guards_path)
1368 1366 and not fl.startswith('.')):
1369 1367 msng_list.append(fl)
1370 for x in util.sort(msng_list):
1368 for x in sorted(msng_list):
1371 1369 pfx = self.ui.verbose and ('D ') or ''
1372 1370 self.ui.write("%s%s\n" % (pfx, displayname(x)))
1373 1371
@@ -88,11 +88,11 b' def purge(ui, repo, *dirs, **opts):'
88 88 match.dir = directories.append
89 89 status = repo.status(match=match, ignored=opts['all'], unknown=True)
90 90
91 for f in util.sort(status[4] + status[5]):
91 for f in sorted(status[4] + status[5]):
92 92 ui.note(_('Removing file %s\n') % f)
93 93 remove(removefile, f)
94 94
95 for f in util.sort(directories)[::-1]:
95 for f in sorted(directories, reverse=True):
96 96 if match(f) and not os.listdir(repo.wjoin(f)):
97 97 ui.note(_('Removing directory %s\n') % f)
98 98 remove(os.rmdir, f)
@@ -109,7 +109,7 b' def rebase(ui, repo, **opts):'
109 109 targetancestors = list(repo.changelog.ancestors(target))
110 110 targetancestors.append(target)
111 111
112 for rev in util.sort(state):
112 for rev in sorted(state):
113 113 if state[rev] == -1:
114 114 storestatus(repo, originalwd, target, state, collapsef, keepf,
115 115 keepbranchesf, external)
@@ -89,7 +89,7 b' class transplanter:'
89 89
90 90 def apply(self, repo, source, revmap, merges, opts={}):
91 91 '''apply the revisions in revmap one by one in revision order'''
92 revs = util.sort(revmap)
92 revs = sorted(revmap)
93 93 p1, p2 = repo.dirstate.parents()
94 94 pulls = []
95 95 diffopts = patch.diffopts(self.ui, opts)
@@ -315,7 +315,7 b' class transplanter:'
315 315 if not os.path.isdir(self.path):
316 316 os.mkdir(self.path)
317 317 series = self.opener('series', 'w')
318 for rev in util.sort(revmap):
318 for rev in sorted(revmap):
319 319 series.write(revlog.hex(revmap[rev]) + '\n')
320 320 if merges:
321 321 series.write('# Merges\n')
@@ -155,7 +155,7 b' class changelog(revlog.revlog):'
155 155
156 156 def encode_extra(self, d):
157 157 # keys must be sorted to produce a deterministic changelog entry
158 items = [_string_escape('%s:%s' % (k, d[k])) for k in util.sort(d)]
158 items = [_string_escape('%s:%s' % (k, d[k])) for k in sorted(d)]
159 159 return "\0".join(items)
160 160
161 161 def read(self, node):
@@ -216,6 +216,6 b' class changelog(revlog.revlog):'
216 216 if extra:
217 217 extra = self.encode_extra(extra)
218 218 parseddate = "%s %s" % (parseddate, extra)
219 l = [hex(manifest), user, parseddate] + util.sort(files) + ["", desc]
219 l = [hex(manifest), user, parseddate] + sorted(files) + ["", desc]
220 220 text = "\n".join(l)
221 221 return self.addrevision(text, transaction, len(self), p1, p2)
@@ -665,7 +665,7 b' class changeset_printer(object):'
665 665 self.ui.write(_("copies: %s\n") % ' '.join(copies))
666 666
667 667 if extra and self.ui.debugflag:
668 for key, value in util.sort(extra.items()):
668 for key, value in sorted(extra.items()):
669 669 self.ui.write(_("extra: %s=%s\n")
670 670 % (key, value.encode('string_escape')))
671 671
@@ -816,7 +816,7 b' class changeset_templater(changeset_prin'
816 816 return showlist('tag', ctx.tags(), **args)
817 817
818 818 def showextras(**args):
819 for key, value in util.sort(ctx.extra().items()):
819 for key, value in sorted(ctx.extra().items()):
820 820 args = args.copy()
821 821 args.update(dict(key=key, value=value))
822 822 yield self.t('extra', **args)
@@ -1163,7 +1163,7 b' def walkchangerevs(ui, repo, pats, chang'
1163 1163 for i, window in increasing_windows(0, len(revs)):
1164 1164 yield 'window', revs[0] < revs[-1], revs[-1]
1165 1165 nrevs = [rev for rev in revs[i:i+window] if want(rev)]
1166 for rev in util.sort(list(nrevs)):
1166 for rev in sorted(nrevs):
1167 1167 fns = fncache.get(rev)
1168 1168 if not fns:
1169 1169 def fns_generator():
@@ -1191,7 +1191,7 b' def commit(ui, repo, commitfunc, pats, o'
1191 1191 m = match(repo, pats, opts)
1192 1192 if pats:
1193 1193 modified, added, removed = repo.status(match=m)[:3]
1194 files = util.sort(modified + added + removed)
1194 files = sorted(modified + added + removed)
1195 1195
1196 1196 def is_dir(f):
1197 1197 name = f + '/'
@@ -446,7 +446,7 b' def branches(ui, repo, active=False):'
446 446 hexfunc = ui.debugflag and hex or short
447 447 activebranches = [encoding.tolocal(repo[n].branch())
448 448 for n in repo.heads(closed=False)]
449 branches = util.sort([(tag in activebranches, repo.changelog.rev(node), tag)
449 branches = sorted([(tag in activebranches, repo.changelog.rev(node), tag)
450 450 for tag, node in repo.branchtags().items()])
451 451 branches.reverse()
452 452
@@ -704,7 +704,7 b' def debugancestor(ui, repo, *args):'
704 704 ui.write("%d:%s\n" % (r.rev(a), hex(a)))
705 705
706 706 def debugcommands(ui, cmd='', *args):
707 for cmd, vals in util.sort(table.iteritems()):
707 for cmd, vals in sorted(table.iteritems()):
708 708 cmd = cmd.split('|')[0].strip('^')
709 709 opts = ', '.join([i[1] for i in vals[1]])
710 710 ui.write('%s: %s\n' % (cmd, opts))
@@ -729,7 +729,7 b" def debugcomplete(ui, cmd='', **opts):"
729 729 cmdlist = cmdutil.findpossible(cmd, table)
730 730 if ui.verbose:
731 731 cmdlist = [' '.join(c[0]) for c in cmdlist.values()]
732 ui.write("%s\n" % "\n".join(util.sort(cmdlist)))
732 ui.write("%s\n" % "\n".join(sorted(cmdlist)))
733 733
734 734 def debugfsinfo(ui, path = "."):
735 735 file('.debugfsinfo', 'w').write('')
@@ -827,7 +827,7 b' def debugstate(ui, repo, nodates=None):'
827 827 """show the contents of the current dirstate"""
828 828 timestr = ""
829 829 showdate = not nodates
830 for file_, ent in util.sort(repo.dirstate._map.iteritems()):
830 for file_, ent in sorted(repo.dirstate._map.iteritems()):
831 831 if showdate:
832 832 if ent[3] == -1:
833 833 # Pad or slice to locale representation
@@ -1258,7 +1258,7 b' def grep(ui, repo, pattern, *pats, **opt'
1258 1258 except error.LookupError:
1259 1259 pass
1260 1260 elif st == 'iter':
1261 for fn, m in util.sort(matches[rev].items()):
1261 for fn, m in sorted(matches[rev].items()):
1262 1262 copy = copies.get(rev, {}).get(fn)
1263 1263 if fn in skip:
1264 1264 if copy:
@@ -1276,7 +1276,7 b' def grep(ui, repo, pattern, *pats, **opt'
1276 1276 fstate[copy] = m
1277 1277 prev[fn] = rev
1278 1278
1279 for fn, state in util.sort(fstate.items()):
1279 for fn, state in sorted(fstate.items()):
1280 1280 if fn in skip:
1281 1281 continue
1282 1282 if fn not in copies.get(prev[fn], {}):
@@ -1424,7 +1424,7 b' def help_(ui, name=None, with_version=Fa'
1424 1424 return
1425 1425
1426 1426 ui.status(header)
1427 fns = util.sort(h)
1427 fns = sorted(h)
1428 1428 m = max(map(len, fns))
1429 1429 for f in fns:
1430 1430 if ui.verbose:
@@ -2327,7 +2327,7 b' def remove(ui, repo, *pats, **opts):'
2327 2327 warn(modified, _('is modified'))
2328 2328 warn(added, _('has been marked for add'))
2329 2329
2330 for f in util.sort(remove + forget):
2330 for f in sorted(remove + forget):
2331 2331 if ui.verbose or not m.exact(f):
2332 2332 ui.status(_('removing %s\n') % m.rel(f))
2333 2333
@@ -2532,7 +2532,7 b' def revert(ui, repo, *pats, **opts):'
2532 2532 (deleted, revert, remove, False, False),
2533 2533 )
2534 2534
2535 for abs, (rel, exact) in util.sort(names.items()):
2535 for abs, (rel, exact) in sorted(names.items()):
2536 2536 mfentry = mf.get(abs)
2537 2537 target = repo.wjoin(abs)
2538 2538 def handle(xlist, dobackup):
@@ -79,7 +79,7 b' class changectx(object):'
79 79 return self.filectx(key)
80 80
81 81 def __iter__(self):
82 for f in util.sort(self._manifest):
82 for f in sorted(self._manifest):
83 83 yield f
84 84
85 85 def changeset(self): return self._changeset
@@ -166,7 +166,7 b' class changectx(object):'
166 166 break
167 167 if match(fn):
168 168 yield fn
169 for fn in util.sort(fdict):
169 for fn in sorted(fdict):
170 170 if match.bad(fn, 'No such file in rev ' + str(self)) and match(fn):
171 171 yield fn
172 172
@@ -412,7 +412,7 b' class filectx(object):'
412 412 visit.extend(fn)
413 413
414 414 hist = {}
415 for r, f in util.sort(visit):
415 for r, f in sorted(visit):
416 416 curr = decorate(f.data(), f)
417 417 for p in parents(f):
418 418 if p != nullid:
@@ -557,7 +557,7 b' class workingctx(changectx):'
557 557 def date(self): return self._date
558 558 def description(self): return self._text
559 559 def files(self):
560 return util.sort(self._status[0] + self._status[1] + self._status[2])
560 return sorted(self._status[0] + self._status[1] + self._status[2])
561 561
562 562 def modified(self): return self._status[0]
563 563 def added(self): return self._status[1]
@@ -606,7 +606,7 b' class workingctx(changectx):'
606 606 return self._parents[0].ancestor(c2) # punt on two parents for now
607 607
608 608 def walk(self, match):
609 return util.sort(self._repo.dirstate.walk(match, True, False).keys())
609 return sorted(self._repo.dirstate.walk(match, True, False))
610 610
611 611 class workingfilectx(filectx):
612 612 """A workingfilectx object makes access to data related to a particular
@@ -727,7 +727,7 b' class memctx(object):'
727 727 parents = [(p or nullid) for p in parents]
728 728 p1, p2 = parents
729 729 self._parents = [changectx(self._repo, p) for p in (p1, p2)]
730 files = util.sort(set(files))
730 files = sorted(set(files))
731 731 self._status = [files, [], [], [], []]
732 732 self._filectxfn = filectxfn
733 733
@@ -10,7 +10,7 b' import util, heapq'
10 10
11 11 def _nonoverlap(d1, d2, d3):
12 12 "Return list of elements in d1 not in d2 or d3"
13 return util.sort([d for d in d1 if d not in d3 and d not in d2])
13 return sorted([d for d in d1 if d not in d3 and d not in d2])
14 14
15 15 def _dirname(f):
16 16 s = f.rfind("/")
@@ -46,7 +46,7 b' def _findoldnames(fctx, limit):'
46 46 visit += [(p, depth - 1) for p in fc.parents()]
47 47
48 48 # return old names sorted by depth
49 return [o[1] for o in util.sort(old.values())]
49 return [o[1] for o in sorted(old.values())]
50 50
51 51 def _findlimit(repo, a, b):
52 52 "find the earliest revision that's an ancestor of a or b but not both"
@@ -177,7 +177,7 b' class dirstate(object):'
177 177 return key in self._map
178 178
179 179 def __iter__(self):
180 for x in util.sort(self._map):
180 for x in sorted(self._map):
181 181 yield x
182 182
183 183 def parents(self):
@@ -460,7 +460,7 b' class dirstate(object):'
460 460 results = {'.hg': None}
461 461
462 462 # step 1: find all explicit files
463 for ff in util.sort(files):
463 for ff in sorted(files):
464 464 nf = normalize(normpath(ff))
465 465 if nf in results:
466 466 continue
@@ -526,7 +526,7 b' class dirstate(object):'
526 526 results[nf] = None
527 527
528 528 # step 3: report unseen items in the dmap hash
529 visit = util.sort([f for f in dmap if f not in results and match(f)])
529 visit = sorted([f for f in dmap if f not in results and match(f)])
530 530 for nf, st in zip(visit, util.statfiles([join(i) for i in visit])):
531 531 if not st is None and not getkind(st.st_mode) in (regkind, lnkkind):
532 532 st = None
@@ -66,7 +66,7 b' def _picktool(repo, ui, path, binary, sy'
66 66 if t not in tools:
67 67 tools[t] = int(_toolstr(ui, t, "priority", "0"))
68 68 names = tools.keys()
69 tools = util.sort([(-p,t) for t,p in tools.items()])
69 tools = sorted([(-p,t) for t,p in tools.items()])
70 70 uimerge = ui.config("ui", "merge")
71 71 if uimerge:
72 72 if uimerge not in names:
@@ -38,7 +38,7 b' class hgwebdir(object):'
38 38 self.repos = cleannames(conf)
39 39 self.repos_sorted = ('', False)
40 40 elif isinstance(conf, dict):
41 self.repos = util.sort(cleannames(conf.items()))
41 self.repos = sorted(cleannames(conf.items()))
42 42 else:
43 43 if isinstance(conf, config.config):
44 44 cp = conf
@@ -293,7 +293,7 b' def manifest(web, req, tmpl):'
293 293 raise ErrorResponse(HTTP_NOT_FOUND, 'path not found: ' + path)
294 294
295 295 def filelist(**map):
296 for f in util.sort(files):
296 for f in sorted(files):
297 297 full = files[f]
298 298
299 299 fctx = ctx.filectx(full)
@@ -305,7 +305,7 b' def manifest(web, req, tmpl):'
305 305 "permissions": mf.flags(full)}
306 306
307 307 def dirlist(**map):
308 for d in util.sort(dirs):
308 for d in sorted(dirs):
309 309
310 310 emptydirs = []
311 311 h = dirs[d]
@@ -384,7 +384,7 b' def summary(web, req, tmpl):'
384 384
385 385 b = web.repo.branchtags()
386 386 l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.iteritems()]
387 for r,n,t in util.sort(l):
387 for r,n,t in sorted(l):
388 388 yield {'parity': parity.next(),
389 389 'branch': t,
390 390 'node': hex(n),
@@ -104,7 +104,7 b' def hook(ui, repo, name, throw=False, **'
104 104 os.dup2(sys.__stderr__.fileno(), sys.__stdout__.fileno())
105 105
106 106 try:
107 for hname, cmd in util.sort(ui.configitems('hooks')):
107 for hname, cmd in ui.configitems('hooks'):
108 108 if hname.split('.')[0] != name or not cmd:
109 109 continue
110 110 if callable(cmd):
@@ -357,7 +357,7 b' class localrepository(repo.repository):'
357 357 except:
358 358 r = -2 # sort to the beginning of the list if unknown
359 359 l.append((r, t, n))
360 return [(t, n) for r, t, n in util.sort(l)]
360 return [(t, n) for r, t, n in sorted(l)]
361 361
362 362 def nodetags(self, node):
363 363 '''return the tags associated with a node'''
@@ -861,7 +861,7 b' class localrepository(repo.repository):'
861 861 tr = None
862 862 valid = 0 # don't save the dirstate if this isn't set
863 863 try:
864 commit = util.sort(wctx.modified() + wctx.added())
864 commit = sorted(wctx.modified() + wctx.added())
865 865 remove = wctx.removed()
866 866 extra = wctx.extra().copy()
867 867 branchname = extra['branch']
@@ -919,7 +919,7 b' class localrepository(repo.repository):'
919 919 remove.append(f)
920 920
921 921 updated, added = [], []
922 for f in util.sort(changed):
922 for f in sorted(changed):
923 923 if f in m1 or f in m2:
924 924 updated.append(f)
925 925 else:
@@ -927,7 +927,7 b' class localrepository(repo.repository):'
927 927
928 928 # update manifest
929 929 m1.update(new)
930 removed = [f for f in util.sort(remove) if f in m1 or f in m2]
930 removed = [f for f in sorted(remove) if f in m1 or f in m2]
931 931 removed1 = []
932 932
933 933 for f in removed:
@@ -1220,7 +1220,7 b' class localrepository(repo.repository):'
1220 1220 return ('close' not in extras)
1221 1221 # sort the output in rev descending order
1222 1222 heads = [(-self.changelog.rev(h), h) for h in heads if display(h)]
1223 return [n for (r, n) in util.sort(heads)]
1223 return [n for (r, n) in sorted(heads)]
1224 1224
1225 1225 def branchheads(self, branch=None, start=None, closed=True):
1226 1226 if branch is None:
@@ -1879,7 +1879,7 b' class localrepository(repo.repository):'
1879 1879 msng_filenode_set.setdefault(fname, {})
1880 1880 changedfiles[fname] = 1
1881 1881 # Go through all our files in order sorted by name.
1882 for fname in util.sort(changedfiles):
1882 for fname in sorted(changedfiles):
1883 1883 filerevlog = self.file(fname)
1884 1884 if not len(filerevlog):
1885 1885 raise util.Abort(_("empty or missing revlog for %s") % fname)
@@ -1969,7 +1969,7 b' class localrepository(repo.repository):'
1969 1969 for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)):
1970 1970 yield chnk
1971 1971
1972 for fname in util.sort(changedfiles):
1972 for fname in sorted(changedfiles):
1973 1973 filerevlog = self.file(fname)
1974 1974 if not len(filerevlog):
1975 1975 raise util.Abort(_("empty or missing revlog for %s") % fname)
@@ -130,7 +130,7 b' class manifest(revlog.revlog):'
130 130 # if we're using the listcache, make sure it is valid and
131 131 # parented by the same node we're diffing against
132 132 if not (changed and self.listcache and p1 and self.mapcache[0] == p1):
133 files = util.sort(map)
133 files = sorted(map)
134 134 checkforbidden(files)
135 135
136 136 # if this is changed to support newlines in filenames,
@@ -1053,7 +1053,7 b' def updatedir(ui, repo, patches, similar'
1053 1053 repo.copy(src, dst)
1054 1054 removes = removes.keys()
1055 1055 if (not similarity) and removes:
1056 repo.remove(util.sort(removes), True)
1056 repo.remove(sorted(removes), True)
1057 1057 for f in patches:
1058 1058 gp = patches[f]
1059 1059 if gp and gp.mode:
@@ -1068,7 +1068,7 b' def updatedir(ui, repo, patches, similar'
1068 1068 cmdutil.addremove(repo, cfiles, similarity=similarity)
1069 1069 files = patches.keys()
1070 1070 files.extend([r for r in removes if r not in files])
1071 return util.sort(files)
1071 return sorted(files)
1072 1072
1073 1073 def externalpatch(patcher, args, patchname, ui, strip, cwd, files):
1074 1074 """use <patcher> to apply <patchname> to the working directory.
@@ -1242,7 +1242,7 b' def diff(repo, node1=None, node2=None, m'
1242 1242 gone = {}
1243 1243 gitmode = {'l': '120000', 'x': '100755', '': '100644'}
1244 1244
1245 for f in util.sort(modified + added + removed):
1245 for f in sorted(modified + added + removed):
1246 1246 to = None
1247 1247 tn = None
1248 1248 dodiff = True
@@ -172,7 +172,7 b' class basicstore:'
172 172 l.append((n, n, st.st_size))
173 173 elif kind == stat.S_IFDIR and recurse:
174 174 visit.append(fp)
175 return util.sort(l)
175 return sorted(l)
176 176
177 177 def datafiles(self):
178 178 return self._walk('data', True)
@@ -211,12 +211,6 b' def binary(s):'
211 211 """return true if a string is binary data"""
212 212 return bool(s and '\0' in s)
213 213
214 def sort(l):
215 if not isinstance(l, list):
216 l = list(l)
217 l.sort()
218 return l
219
220 214 def increasingchunks(source, min=1024, max=65536):
221 215 '''return no less than min bytes per chunk while data remains,
222 216 doubling min after each chunk until it reaches max'''
@@ -143,17 +143,17 b' def _verify(repo):'
143 143 ui.status(_("crosschecking files in changesets and manifests\n"))
144 144
145 145 if havemf:
146 for c, m in util.sort([(c, m) for m in mflinkrevs for c in mflinkrevs[m]]):
146 for c,m in sorted([(c, m) for m in mflinkrevs for c in mflinkrevs[m]]):
147 147 err(c, _("changeset refers to unknown manifest %s") % short(m))
148 148 del mflinkrevs
149 149
150 for f in util.sort(filelinkrevs):
150 for f in sorted(filelinkrevs):
151 151 if f not in filenodes:
152 152 lr = filelinkrevs[f][0]
153 153 err(lr, _("in changeset but not in manifest"), f)
154 154
155 155 if havecl:
156 for f in util.sort(filenodes):
156 for f in sorted(filenodes):
157 157 if f not in filelinkrevs:
158 158 try:
159 159 fl = repo.file(f)
@@ -171,7 +171,7 b' def _verify(repo):'
171 171 elif size > 0:
172 172 storefiles[f] = True
173 173
174 files = util.sort(set(filenodes) | set(filelinkrevs))
174 files = sorted(set(filenodes) | set(filelinkrevs))
175 175 for f in files:
176 176 lr = filelinkrevs[f][0]
177 177 try:
@@ -227,7 +227,7 b' def _verify(repo):'
227 227 # cross-check
228 228 if f in filenodes:
229 229 fns = [(mf.linkrev(l), n) for n,l in filenodes[f].iteritems()]
230 for lr, node in util.sort(fns):
230 for lr, node in sorted(fns):
231 231 err(lr, _("%s in manifests not found") % short(node), f)
232 232
233 233 for f in storefiles:
@@ -60,6 +60,7 b' 4:8ea2ef7ad3e8'
60 60 precommit hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198
61 61 pretxncommit hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=true
62 62 5:fad284daf8c0
63 5:fad284daf8c0
63 64 pretxncommit.forbid hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=true
64 65 transaction abort!
65 66 rollback completed
General Comments 0
You need to be logged in to leave comments. Login now