Mercurial > hg
diff hgext/convert/subversion.py @ 8209:a1a5a57efe90
replace util.sort with sorted built-in
This is marginally faster for small and moderately-sized lists
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 26 Apr 2009 16:50:44 -0500 |
parents | cce63ef1045b |
children | 344751cd8cb8 |
line wrap: on
line diff
--- a/hgext/convert/subversion.py Sun Apr 26 16:50:44 2009 -0500 +++ b/hgext/convert/subversion.py Sun Apr 26 16:50:44 2009 -0500 @@ -712,7 +712,7 @@ # This will fail if a directory was copied # from another branch and then some of its files # were deleted in the same transaction. - children = util.sort(self._find_children(path, revnum)) + children = sorted(self._find_children(path, revnum)) for child in children: # Can we move a child directory and its # parent in the same commit? (probably can). Could @@ -779,7 +779,7 @@ parents = [] # check whether this revision is the start of a branch or part # of a branch renaming - orig_paths = util.sort(orig_paths.items()) + orig_paths = sorted(orig_paths.iteritems()) root_paths = [(p,e) for p,e in orig_paths if self.module.startswith(p)] if root_paths: path, ent = root_paths[-1] @@ -1108,7 +1108,7 @@ return dirs def add_dirs(self, files): - add_dirs = [d for d in util.sort(self.dirs_of(files)) + add_dirs = [d for d in sorted(self.dirs_of(files)) if not os.path.exists(self.wjoin(d, '.svn', 'entries'))] if add_dirs: self.xargs(add_dirs, 'add', non_recursive=True, quiet=True) @@ -1120,10 +1120,8 @@ return files def tidy_dirs(self, names): - dirs = util.sort(self.dirs_of(names)) - dirs.reverse() deleted = [] - for d in dirs: + for d in sorted(self.dirs_of(names), reverse=True): wd = self.wjoin(d) if os.listdir(wd) == '.svn': self.run0('delete', d)