##// END OF EJS Templates
replace various uses of list.reverse()
Matt Mackall -
r8210:344751cd default
parent child Browse files
Show More
@@ -437,9 +437,8 b' class svn_source(converter_source):'
437 origpaths, revnum, author, date, message = entry
437 origpaths, revnum, author, date, message = entry
438 copies = [(e.copyfrom_path, e.copyfrom_rev, p) for p, e
438 copies = [(e.copyfrom_path, e.copyfrom_rev, p) for p, e
439 in origpaths.iteritems() if e.copyfrom_path]
439 in origpaths.iteritems() if e.copyfrom_path]
440 copies.sort()
441 # Apply moves/copies from more specific to general
440 # Apply moves/copies from more specific to general
442 copies.reverse()
441 copies.sort(reverse=True)
443
442
444 srctagspath = tagspath
443 srctagspath = tagspath
445 if copies and copies[-1][2] == tagspath:
444 if copies and copies[-1][2] == tagspath:
@@ -90,11 +90,9 b' def sigwalk(repo):'
90 yield (l.split(" ", 2), (context, ln))
90 yield (l.split(" ", 2), (context, ln))
91 ln +=1
91 ln +=1
92
92
93 # read the heads
93 fl = repo.file(".hgsigs")
94 fl = repo.file(".hgsigs")
94 h = fl.heads()
95 for r in reversed(fl.heads()):
95 h.reverse()
96 # read the heads
97 for r in h:
98 fn = ".hgsigs|%s" % hgnode.short(r)
96 fn = ".hgsigs|%s" % hgnode.short(r)
99 for item in parsefile(fl.read(r).splitlines(), fn):
97 for item in parsefile(fl.read(r).splitlines(), fn):
100 yield item
98 yield item
@@ -154,9 +152,7 b' def sigs(ui, repo):'
154 continue
152 continue
155 revs.setdefault(r, [])
153 revs.setdefault(r, [])
156 revs[r].extend(keys)
154 revs[r].extend(keys)
157 nodes = list(revs)
155 for rev in reversed(revs):
158 nodes.reverse()
159 for rev in nodes:
160 for k in revs[rev]:
156 for k in revs[rev]:
161 r = "%5d:%s" % (rev, hgnode.hex(repo.changelog.node(rev)))
157 r = "%5d:%s" % (rev, hgnode.hex(repo.changelog.node(rev)))
162 ui.write("%-30s %s\n" % (keystr(ui, k), r))
158 ui.write("%-30s %s\n" % (keystr(ui, k), r))
@@ -285,11 +285,10 b' def graphlog(ui, repo, path=None, **opts'
285 ascii(ui, grapher(graphdag))
285 ascii(ui, grapher(graphdag))
286
286
287 def graphrevs(repo, nodes, opts):
287 def graphrevs(repo, nodes, opts):
288 nodes.reverse()
289 include = set(nodes)
288 include = set(nodes)
290 limit = cmdutil.loglimit(opts)
289 limit = cmdutil.loglimit(opts)
291 count = 0
290 count = 0
292 for node in nodes:
291 for node in reversed(nodes):
293 if count >= limit:
292 if count >= limit:
294 break
293 break
295 ctx = repo[node]
294 ctx = repo[node]
@@ -286,10 +286,7 b' def updatemq(repo, state, skipped, **opt'
286 repo.mq.finish(repo, mqrebase.keys())
286 repo.mq.finish(repo, mqrebase.keys())
287
287
288 # We must start import from the newest revision
288 # We must start import from the newest revision
289 mq = mqrebase.keys()
289 for rev in sorted(mqrebase, reverse=True):
290 mq.sort()
291 mq.reverse()
292 for rev in mq:
293 if rev not in skipped:
290 if rev not in skipped:
294 repo.ui.debug(_('import mq patch %d (%s)\n')
291 repo.ui.debug(_('import mq patch %d (%s)\n')
295 % (state[rev], mqrebase[rev][0]))
292 % (state[rev], mqrebase[rev][0]))
@@ -1052,8 +1052,7 b' def walkchangerevs(ui, repo, pats, chang'
1052 n = filelog.node(j)
1052 n = filelog.node(j)
1053 revs.append((filelog.linkrev(j),
1053 revs.append((filelog.linkrev(j),
1054 follow and filelog.renamed(n)))
1054 follow and filelog.renamed(n)))
1055 revs.reverse()
1055 for rev in reversed(revs):
1056 for rev in revs:
1057 # only yield rev for which we have the changelog, it can
1056 # only yield rev for which we have the changelog, it can
1058 # happen while doing "hg log" during a pull or commit
1057 # happen while doing "hg log" during a pull or commit
1059 if rev[0] < cl_count:
1058 if rev[0] < cl_count:
@@ -447,8 +447,8 b' def branches(ui, repo, active=False):'
447 activebranches = [encoding.tolocal(repo[n].branch())
447 activebranches = [encoding.tolocal(repo[n].branch())
448 for n in repo.heads(closed=False)]
448 for n in repo.heads(closed=False)]
449 branches = sorted([(tag in activebranches, repo.changelog.rev(node), tag)
449 branches = sorted([(tag in activebranches, repo.changelog.rev(node), tag)
450 for tag, node in repo.branchtags().items()])
450 for tag, node in repo.branchtags().items()],
451 branches.reverse()
451 reverse=True)
452
452
453 for isactive, node, tag in branches:
453 for isactive, node, tag in branches:
454 if (not active) or isactive:
454 if (not active) or isactive:
@@ -2870,12 +2870,10 b' def tags(ui, repo):'
2870 switch is used, a third column "local" is printed for local tags.
2870 switch is used, a third column "local" is printed for local tags.
2871 """
2871 """
2872
2872
2873 l = repo.tagslist()
2874 l.reverse()
2875 hexfunc = ui.debugflag and hex or short
2873 hexfunc = ui.debugflag and hex or short
2876 tagtype = ""
2874 tagtype = ""
2877
2875
2878 for t, n in l:
2876 for t, n in reversed(repo.tagslist()):
2879 if ui.quiet:
2877 if ui.quiet:
2880 ui.write("%s\n" % t)
2878 ui.write("%s\n" % t)
2881 continue
2879 continue
@@ -331,11 +331,9 b' class localrepository(repo.repository):'
331 return self._tagstypecache.get(tagname)
331 return self._tagstypecache.get(tagname)
332
332
333 def _hgtagsnodes(self):
333 def _hgtagsnodes(self):
334 heads = self.heads()
335 heads.reverse()
336 last = {}
334 last = {}
337 ret = []
335 ret = []
338 for node in heads:
336 for node in reversed(self.heads()):
339 c = self[node]
337 c = self[node]
340 rev = c.rev()
338 rev = c.rev()
341 try:
339 try:
@@ -81,8 +81,7 b' class sshrepository(repo.repository):'
81 self.abort(error.RepoError(_("no suitable response from remote hg")))
81 self.abort(error.RepoError(_("no suitable response from remote hg")))
82
82
83 self.capabilities = set()
83 self.capabilities = set()
84 lines.reverse()
84 for l in reversed(lines):
85 for l in lines:
86 if l.startswith("capabilities:"):
85 if l.startswith("capabilities:"):
87 self.capabilities.update(l[:-1].split(":")[1].split())
86 self.capabilities.update(l[:-1].split(":")[1].split())
88 break
87 break
@@ -183,9 +183,7 b' class basicstore:'
183 for x in self.datafiles():
183 for x in self.datafiles():
184 yield x
184 yield x
185 # yield manifest before changelog
185 # yield manifest before changelog
186 meta = self._walk('', False)
186 for x in reversed(self._walk('', False)):
187 meta.reverse()
188 for x in meta:
189 yield x
187 yield x
190
188
191 def copylist(self):
189 def copylist(self):
General Comments 0
You need to be logged in to leave comments. Login now