Rev 1655: Use simple branch enumeration if possible. in file:///data/jelmer/bzr-svn/find-tags/
Jelmer Vernooij
jelmer at samba.org
Tue Aug 26 01:53:42 BST 2008
At file:///data/jelmer/bzr-svn/find-tags/
------------------------------------------------------------
revno: 1655
revision-id: jelmer at samba.org-20080826005341-vk9v1tq4zdhc127e
parent: jelmer at samba.org-20080826001908-44kqqm1s9tozgmcq
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: find-tags
timestamp: Tue 2008-08-26 02:53:41 +0200
message:
Use simple branch enumeration if possible.
modified:
convert.py svn2bzr.py-20051018015439-cb4563bff29e632d
repository.py repository.py-20060306123302-1f8c5069b3fe0265
=== modified file 'convert.py'
--- a/convert.py 2008-08-26 00:19:08 +0000
+++ b/convert.py 2008-08-26 00:53:41 +0000
@@ -172,14 +172,22 @@
else:
from_revnum = 0
to_revnum = source_repos.get_latest_revnum()
- removed_branches, changed_branches = source_repos.find_branches_between(layout=layout,
- from_revnum=from_revnum, to_revnum=to_revnum)
- existing_branches = []
- for bp in changed_branches:
- try:
- existing_branches.append(SvnBranch(source_repos, bp))
- except NotBranchError: # Skip non-directories
- pass
+ # Searching history for touched and removed branches is more expensive than
+ # just listing the branches in HEAD, so avoid it if possible.
+ # If there's more than one subdirectory (we always have .bzr), we may
+ # have to remove existing branches.
+ if from_revnum == 0 or (not keep and len(to_transport.list_dir(".")) > 1):
+ removed_branches, changed_branches = source_repos.find_branches_between(layout=layout,
+ from_revnum=from_revnum, to_revnum=to_revnum)
+ existing_branches = []
+ for bp in changed_branches:
+ try:
+ existing_branches.append(SvnBranch(source_repos, bp))
+ except NotBranchError: # Skip non-directories
+ pass
+ else:
+ existing_branches = source_repos.find_branches(layout=layout, revnum=to_revnum)
+
if filter_branch is not None:
existing_branches = filter(filter_branch, existing_branches)
=== modified file 'repository.py'
--- a/repository.py 2008-08-26 00:19:08 +0000
+++ b/repository.py 2008-08-26 00:53:41 +0000
@@ -786,7 +786,7 @@
return deleted, created
@needs_read_lock
- def find_branches(self, using=False, layout=None):
+ def find_branches(self, using=False, layout=None, revnum=None):
"""Find branches underneath this repository.
This will include branches inside other branches.
@@ -798,11 +798,13 @@
# ignored.
if layout is None:
layout = self.get_layout()
+ if revnum is None:
+ revnum = self.get_latest_revnum()
branches = []
pb = ui.ui_factory.nested_progress_bar()
try:
- for project, bp, nick in layout.get_branches(self.get_latest_revnum(), pb=pb):
+ for project, bp, nick in layout.get_branches(revnum, pb=pb):
branches.append(SvnBranch(self, bp, _skip_check=True))
finally:
pb.finished()
More information about the bazaar-commits
mailing list