Rev 1596: Avoid browsing old branches to search for revids when pushing. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk
Jelmer Vernooij
jelmer at samba.org
Fri Aug 22 15:20:23 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/trunk
------------------------------------------------------------
revno: 1596
revision-id: jelmer at samba.org-20080822142019-rdplgjkxf87tgw2e
parent: jelmer at samba.org-20080822133831-8aecb3e2hoe4m6o4
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Fri 2008-08-22 16:20:19 +0200
message:
Avoid browsing old branches to search for revids when pushing.
modified:
branch.py svnbranch.py-20051017135706-11c749eb0dab04a7
mapping3/__init__.py __init__.py-20080502174630-9324zh25kka98vlw-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
=== modified file 'branch.py'
--- a/branch.py 2008-08-04 16:23:24 +0000
+++ b/branch.py 2008-08-22 14:20:19 +0000
@@ -140,7 +140,7 @@
class SvnBranch(Branch):
"""Maps to a Branch in a Subversion repository """
- def __init__(self, repository, branch_path):
+ def __init__(self, repository, branch_path, _skip_check=False):
"""Instantiate a new SvnBranch.
:param repos: SvnRepository this branch is part of.
@@ -162,15 +162,16 @@
self.base = urlutils.join(self.repository.base, self._branch_path).rstrip("/")
self._revmeta_cache = None
assert isinstance(self._branch_path, str)
- try:
- revnum = self.get_revnum()
- if self.repository.transport.check_path(self._branch_path,
- revnum) != core.NODE_DIR:
- raise NotBranchError(self.base)
- except SubversionException, (_, num):
- if num == ERR_FS_NO_SUCH_REVISION:
- raise NotBranchError(self.base)
- raise
+ if not _skip_check:
+ try:
+ revnum = self.get_revnum()
+ if self.repository.transport.check_path(self._branch_path,
+ revnum) != core.NODE_DIR:
+ raise NotBranchError(self.base)
+ except SubversionException, (_, num):
+ if num == ERR_FS_NO_SUCH_REVISION:
+ raise NotBranchError(self.base)
+ raise
(type, self.project, _, ip) = self.layout.parse(branch_path)
# FIXME: Don't allow tag here
if type not in ('branch', 'tag') or ip != '':
=== modified file 'mapping3/__init__.py'
--- a/mapping3/__init__.py 2008-08-22 05:02:07 +0000
+++ b/mapping3/__init__.py 2008-08-22 14:20:19 +0000
@@ -25,6 +25,7 @@
guess_scheme_from_history, ListBranchingScheme,
parse_list_scheme_text, NoBranchingScheme,
TrunkBranchingScheme, ListBranchingScheme)
+from bzrlib.plugins.svn.ra import DIRENT_KIND
import sha
SVN_PROP_BZR_BRANCHING_SCHEME = 'bzr:branching-scheme'
@@ -94,12 +95,12 @@
def find_children(path):
try:
assert not path.startswith("/")
- dirents = self.repository.transport.get_dir(path, revnum)[0]
+ dirents = self.repository.transport.get_dir(path, revnum, DIRENT_KIND)[0]
except SubversionException, (msg, num):
if num in (ERR_FS_NOT_DIRECTORY, ERR_FS_NOT_FOUND, ERR_RA_DAV_PATH_NOT_FOUND):
return None
raise
- return dirents.keys()
+ return [d for d in dirents if dirents[d]['kind'] == NODE_DIR]
for idx, pattern in enumerate(self.scheme.branch_list):
if pb is not None:
=== modified file 'repository.py'
--- a/repository.py 2008-08-22 05:02:07 +0000
+++ b/repository.py 2008-08-22 14:20:19 +0000
@@ -786,7 +786,7 @@
try:
for project, bp, nick in layout.get_branches(self.get_latest_revnum(), pb=pb):
try:
- branches.append(SvnBranch(self, bp))
+ branches.append(SvnBranch(self, bp, _skip_check=True))
except NotBranchError: # Skip non-directories
pass
finally:
@@ -911,14 +911,13 @@
def find_fileprop_branches(self, layout, from_revnum, to_revnum,
project=None):
reuse_policy = self.get_config().get_reuse_revisions()
- if reuse_policy == "removed-branches":
- for (branch, revno, _) in self.find_branchpaths(layout,
+ if reuse_policy in ("other-branches", "none") or from_revnum == 0:
+ for (project, branch, nick) in layout.get_branches(to_revnum, project):
+ yield (branch, to_revnum)
+ elif reuse_policy in ("other-branches", "removed-branches", "none"):
+ for (branch, revno, exists) in self.find_branchpaths(layout,
from_revnum, to_revnum, project):
yield (branch, revno)
- elif reuse_policy in ("other-branches", "none"):
- revnum = self.get_latest_revnum()
- for (project, branch, nick) in layout.get_branches(revnum, project):
- yield (branch, revnum)
else:
assert False
More information about the bazaar-commits
mailing list