Mercurial > hg-stable
changeset 11127:ab575114ddd8 stable
convert/svn: do not retrieve removed files
It gives us a way to not retrieve content of entries we know are no longer
files. And it is faster when converting remote repositories.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 09 May 2010 19:11:02 +0200 |
parents | f7535c433d22 |
children | a9b427b5821e |
files | hgext/convert/subversion.py |
diffstat | 1 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/subversion.py Sun May 09 19:11:02 2010 +0200 +++ b/hgext/convert/subversion.py Sun May 09 19:11:02 2010 +0200 @@ -386,7 +386,7 @@ self.modecache = {} (paths, parents) = self.paths[rev] if parents: - files, copies = self.expandpaths(rev, paths, parents) + files, self.removed, copies = self.expandpaths(rev, paths, parents) else: # Perform a full checkout on roots uuid, module, revnum = self.revsplit(rev) @@ -395,6 +395,7 @@ files = [n for n, e in entries.iteritems() if e.kind == svn.core.svn_node_file] copies = {} + self.removed = set() files.sort() files = zip(files, [rev] * len(files)) @@ -610,7 +611,7 @@ return prevmodule def expandpaths(self, rev, paths, parents): - entries = [] + changed, removed = set(), set() # Map of entrypath, revision for finding source of deleted # revisions. copyfrom = {} @@ -626,7 +627,7 @@ kind = self._checkpath(entrypath, revnum) if kind == svn.core.svn_node_file: - entries.append(self.recode(entrypath)) + changed.add(self.recode(entrypath)) if not ent.copyfrom_path or not parents: continue # Copy sources not in parent revisions cannot be @@ -654,7 +655,7 @@ self.reparent(prevmodule) if fromkind == svn.core.svn_node_file: - entries.append(self.recode(entrypath)) + removed.add(self.recode(entrypath)) elif fromkind == svn.core.svn_node_dir: oroot = parentpath.strip('/') nroot = path.strip('/') @@ -663,7 +664,7 @@ for child in children: childpath = self.getrelpath("/" + child, pmodule) if childpath: - entries.append(self.recode(childpath)) + removed.add(self.recode(childpath)) else: self.ui.debug('unknown path in revision %d: %s\n' % \ (revnum, path)) @@ -684,7 +685,7 @@ # Need to filter out directories here... kind = self._checkpath(entrypath, revnum) if kind != svn.core.svn_node_dir: - entries.append(self.recode(entrypath)) + changed.add(self.recode(entrypath)) # Handle directory copies if not ent.copyfrom_path or not parents: @@ -710,7 +711,8 @@ copytopath = self.getrelpath(copytopath) copies[self.recode(copytopath)] = self.recode(entrypath) - return (list(set(entries)), copies) + changed.update(removed) + return (list(changed), removed, copies) def _fetch_revisions(self, from_revnum, to_revnum): if from_revnum < to_revnum: @@ -839,6 +841,8 @@ def _getfile(self, file, rev): # TODO: ra.get_file transmits the whole file instead of diffs. + if file in self.removed: + raise IOError() mode = '' try: new_module, revnum = self.revsplit(rev)[1:]