# HG changeset patch # User Patrick Mezard # Date 1350370021 -7200 # Node ID e1cb98792cf4b674c501fadbd1b967f0acc2f050 # Parent 289f2c7752a8e613150d76898df3cbc7f926d109 editor: do not reread all data upon branching Branch creation is a special case of add_directory(). Until now, it was handled by enumerating branch parent files and creating svncopy records which were later converted into open files or pushed into the RevisionData. By default, there is no reason to record anything, the files are the same than in the parent changeset. The tricky part is to correctly check the source is the parent revision. This change massively speeds up regular branching operations. diff --git a/hgsubversion/editor.py b/hgsubversion/editor.py --- a/hgsubversion/editor.py +++ b/hgsubversion/editor.py @@ -428,18 +428,28 @@ class HgEditor(svnwrap.Editor): frompath = '%s/' % frompath else: frompath = '' + + copyfromparent = False + if frompath == '' and br_path == '': + pnode = self.meta.get_parent_revision( + self.current.rev.revnum, branch) + if pnode == new_hash: + # Data parent is topological parent and relative paths + # are the same, not need to do anything but restore + # files marked as deleted. + copyfromparent = True + svncopies = {} copies = {} for f in fromctx: if not f.startswith(frompath): continue - fctx = fromctx.filectx(f) dest = path + '/' + f[len(frompath):] - svncopies[dest] = CopiedFile(new_hash, f, None) if dest in self._deleted: - # Remove this once svn copies and edited files are - # clearly separated. self._deleted.remove(dest) + if copyfromparent: + continue + svncopies[dest] = CopiedFile(new_hash, f, None) if branch == source_branch: copies[dest] = f if copies: