Rev 1654: Fix searching of new branches. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk
Jelmer Vernooij
jelmer at samba.org
Tue Aug 26 01:25:03 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/trunk
------------------------------------------------------------
revno: 1654
revision-id: jelmer at samba.org-20080826002501-arkzcguo81eea0gt
parent: jelmer at samba.org-20080825221254-t01sb5wgi9gq0nlb
parent: jelmer at samba.org-20080826001908-44kqqm1s9tozgmcq
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2008-08-26 02:25:01 +0200
message:
Fix searching of new branches.
modified:
convert.py svn2bzr.py-20051018015439-cb4563bff29e632d
repository.py repository.py-20060306123302-1f8c5069b3fe0265
------------------------------------------------------------
revno: 1653.1.1
revision-id: jelmer at samba.org-20080826001908-44kqqm1s9tozgmcq
parent: jelmer at samba.org-20080825221254-t01sb5wgi9gq0nlb
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: find-tags
timestamp: Tue 2008-08-26 02:19:08 +0200
message:
Fix searching of new branches.
modified:
convert.py svn2bzr.py-20051018015439-cb4563bff29e632d
repository.py repository.py-20060306123302-1f8c5069b3fe0265
=== modified file 'convert.py'
--- a/convert.py 2008-08-23 14:55:24 +0000
+++ b/convert.py 2008-08-26 00:19:08 +0000
@@ -172,19 +172,14 @@
else:
from_revnum = 0
to_revnum = source_repos.get_latest_revnum()
- changed_branches = source_repos.find_fileprop_paths(layout=layout,
- from_revnum=from_revnum, to_revnum=to_revnum, check_removed=True,
- find_branches=True, find_tags=False)
+ removed_branches, changed_branches = source_repos.find_branches_between(layout=layout,
+ from_revnum=from_revnum, to_revnum=to_revnum)
existing_branches = []
- removed_branches = []
- for (bp, revnum, exists) in changed_branches:
- if not exists and not keep:
- removed_branches.append((bp, revnum))
- elif exists and layout.is_branch(bp):
- try:
- existing_branches.append(SvnBranch(source_repos, bp))
- except NotBranchError: # Skip non-directories
- pass
+ for bp in changed_branches:
+ try:
+ existing_branches.append(SvnBranch(source_repos, bp))
+ except NotBranchError: # Skip non-directories
+ pass
if filter_branch is not None:
existing_branches = filter(filter_branch, existing_branches)
@@ -198,14 +193,15 @@
inter._supports_branches):
inter.fetch(branches=existing_branches)
- # Remove removed branches
- for (bp, revnum) in removed_branches:
- # TODO: Perhaps check if path is a valid branch with the right last
- # revid?
- fullpath = to_transport.local_abspath(bp)
- if not os.path.isdir(fullpath):
- continue
- osutils.rmtree(fullpath)
+ if not keep:
+ # Remove removed branches
+ for bp in removed_branches:
+ # TODO: Perhaps check if path is a valid branch with the right last
+ # revid?
+ fullpath = to_transport.local_abspath(bp)
+ if not os.path.isdir(fullpath):
+ continue
+ osutils.rmtree(fullpath)
source_graph = source_repos.get_graph()
pb = ui.ui_factory.nested_progress_bar()
=== modified file 'repository.py'
--- a/repository.py 2008-08-24 22:15:46 +0000
+++ b/repository.py 2008-08-26 00:19:08 +0000
@@ -768,6 +768,24 @@
raise errors.RevpropChangeFailed(SVN_REVPROP_BZR_SIGNATURE)
@needs_read_lock
+ def find_branches_between(self, layout, from_revnum, to_revnum):
+ deleted = set()
+ created = set()
+ for (paths, revnum, revprops) in self._log.iter_changes(None, from_revnum, to_revnum):
+ for p in paths:
+ try:
+ (pt, project, bp, rp) = layout.parse(p)
+ if pt == "branch":
+ if paths[p][0] != 'D' or rp != "":
+ created.add(bp)
+ elif paths[p][0] == 'D' and rp == "":
+ deleted.add(bp)
+ except errors.InvalidSvnBranchPath:
+ if paths[p][0] == 'D':
+ deleted.add(p)
+ return deleted, created
+
+ @needs_read_lock
def find_branches(self, using=False, layout=None):
"""Find branches underneath this repository.
@@ -841,7 +859,9 @@
range.
:param revnum: Revision to search for branches.
- :return: iterator that returns tuples with (path, revision number, still exists). The revision number is the revision in which the branch last existed.
+ :return: iterator that returns tuples with (path, revision number,
+ still exists). The revision number is the revision in which the
+ branch last existed.
"""
if to_revnum is None:
to_revnum = self.get_latest_revnum()
More information about the bazaar-commits
mailing list