Mercurial > public > mercurial-scm > hg-stable
diff hgext/mq.py @ 6762:f67d1468ac50
util: add sort helper
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 27 Jun 2008 18:28:45 -0500 |
parents | 4faaa0535ea7 |
children | 04503b757935 |
line wrap: on
line diff
--- a/hgext/mq.py Fri Jun 27 14:53:30 2008 -0500 +++ b/hgext/mq.py Fri Jun 27 18:28:45 2008 -0500 @@ -143,8 +143,7 @@ bad = self.check_guard(guard) if bad: raise util.Abort(bad) - guards = dict.fromkeys(guards).keys() - guards.sort() + guards = util.sort(util.unique(guards)) self.ui.debug('active guards: %s\n' % ' '.join(guards)) self.active_guards = guards self.guards_dirty = True @@ -536,8 +535,7 @@ return (err, n) def _clean_series(self, patches): - indices = [self.find_series(p) for p in patches] - indices.sort() + indices = util.sort([self.find_series(p) for p in patches]) for i in indices[-1::-1]: del self.full_series[i] self.parse_series() @@ -545,10 +543,10 @@ def finish(self, repo, revs): revs.sort() - firstrev = repo.changelog.rev(revlog.bin(self.applied[0].rev)) + firstrev = repo[self.applied[0].rev].rev() appliedbase = 0 patches = [] - for rev in revs: + for rev in util.sort(revs): if rev < firstrev: raise util.Abort(_('revision %d is not managed') % rev) base = revlog.bin(self.applied[appliedbase].rev) @@ -1261,8 +1259,7 @@ self.guards_path) and not fl.startswith('.')): msng_list.append(fl) - msng_list.sort() - for x in msng_list: + for x in util.sort(msng_list): pfx = self.ui.verbose and ('D ') or '' self.ui.write("%s%s\n" % (pfx, displayname(x)))