Mercurial > hg
comparison hgext/convert/subversion.py @ 11133:d7b6aab612b4
convert/svn: remove useless sort
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 09 May 2010 21:49:57 +0200 |
parents | 321b8b2aa20f |
children | 33010ff1fd6f |
comparison
equal
deleted
inserted
replaced
11132:321b8b2aa20f | 11133:d7b6aab612b4 |
---|---|
647 if fromkind == svn.core.svn_node_file: | 647 if fromkind == svn.core.svn_node_file: |
648 removed.add(self.recode(entrypath)) | 648 removed.add(self.recode(entrypath)) |
649 elif fromkind == svn.core.svn_node_dir: | 649 elif fromkind == svn.core.svn_node_dir: |
650 oroot = parentpath.strip('/') | 650 oroot = parentpath.strip('/') |
651 nroot = path.strip('/') | 651 nroot = path.strip('/') |
652 children = self._listfiles(oroot, prevnum) | 652 children = self._iterfiles(oroot, prevnum) |
653 for childpath in children: | 653 for childpath in children: |
654 childpath = childpath.replace(oroot, nroot) | 654 childpath = childpath.replace(oroot, nroot) |
655 childpath = self.getrelpath("/" + childpath, pmodule) | 655 childpath = self.getrelpath("/" + childpath, pmodule) |
656 if childpath: | 656 if childpath: |
657 removed.add(self.recode(childpath)) | 657 removed.add(self.recode(childpath)) |
669 pmodule, prevnum = self.revsplit(parents[0])[1:] | 669 pmodule, prevnum = self.revsplit(parents[0])[1:] |
670 pkind = self._checkpath(entrypath, prevnum, pmodule) | 670 pkind = self._checkpath(entrypath, prevnum, pmodule) |
671 if pkind == svn.core.svn_node_file: | 671 if pkind == svn.core.svn_node_file: |
672 removed.add(self.recode(entrypath)) | 672 removed.add(self.recode(entrypath)) |
673 | 673 |
674 children = sorted(self._listfiles(path, revnum)) | 674 for childpath in self._iterfiles(path, revnum): |
675 for childpath in children: | |
676 childpath = self.getrelpath("/" + childpath) | 675 childpath = self.getrelpath("/" + childpath) |
677 if childpath: | 676 if childpath: |
678 changed.add(self.recode(childpath)) | 677 changed.add(self.recode(childpath)) |
679 | 678 |
680 # Handle directory copies | 679 # Handle directory copies |
688 copyfrompath = self.getrelpath(ent.copyfrom_path, pmodule) | 687 copyfrompath = self.getrelpath(ent.copyfrom_path, pmodule) |
689 if not copyfrompath: | 688 if not copyfrompath: |
690 continue | 689 continue |
691 self.ui.debug("mark %s came from %s:%d\n" | 690 self.ui.debug("mark %s came from %s:%d\n" |
692 % (path, copyfrompath, ent.copyfrom_rev)) | 691 % (path, copyfrompath, ent.copyfrom_rev)) |
693 children = self._listfiles(ent.copyfrom_path, ent.copyfrom_rev) | 692 children = self._iterfiles(ent.copyfrom_path, ent.copyfrom_rev) |
694 children.sort() | |
695 for childpath in children: | 693 for childpath in children: |
696 childpath = self.getrelpath("/" + childpath, pmodule) | 694 childpath = self.getrelpath("/" + childpath, pmodule) |
697 if not childpath: | 695 if not childpath: |
698 continue | 696 continue |
699 copytopath = path + childpath[len(copyfrompath):] | 697 copytopath = path + childpath[len(copyfrompath):] |
858 link_prefix = "link " | 856 link_prefix = "link " |
859 if data.startswith(link_prefix): | 857 if data.startswith(link_prefix): |
860 data = data[len(link_prefix):] | 858 data = data[len(link_prefix):] |
861 return data, mode | 859 return data, mode |
862 | 860 |
863 def _listfiles(self, path, revnum): | 861 def _iterfiles(self, path, revnum): |
864 """List all files in path at revnum, recursively.""" | 862 """Enumerate all files in path at revnum, recursively.""" |
865 path = path.strip('/') | 863 path = path.strip('/') |
866 pool = Pool() | 864 pool = Pool() |
867 rpath = '/'.join([self.baseurl, urllib.quote(path)]).strip('/') | 865 rpath = '/'.join([self.baseurl, urllib.quote(path)]).strip('/') |
868 entries = svn.client.ls(rpath, optrev(revnum), True, self.ctx, pool) | 866 entries = svn.client.ls(rpath, optrev(revnum), True, self.ctx, pool) |
869 return [(path + '/' + p) for p, e in entries.iteritems() | 867 return ((path + '/' + p) for p, e in entries.iteritems() |
870 if e.kind == svn.core.svn_node_file] | 868 if e.kind == svn.core.svn_node_file) |
871 | 869 |
872 def getrelpath(self, path, module=None): | 870 def getrelpath(self, path, module=None): |
873 if module is None: | 871 if module is None: |
874 module = self.module | 872 module = self.module |
875 # Given the repository url of this wc, say | 873 # Given the repository url of this wc, say |