if k.startswith(SVN_PROP_BZR_PREFIX):
return 1
return 0
+
+
+def get_roundtrip_ancestor_revids(fileprops):
+ for propname, propvalue in fileprops.items():
+ if not propname.startswith(SVN_PROP_BZR_REVISION_ID):
+ continue
+ mapping_name = propname[len(SVN_PROP_BZR_REVISION_ID):]
+ for line in propvalue.splitlines():
+ try:
+ (revno, revid) = parse_revid_property(line)
+ except svn_errors.InvalidPropertyValue, ie:
+ mutter(str(ie))
+ yield (revid, revno, mapping_name)
+
revids = set()
try:
revmeta = self.repos._revmeta_provider.get_revision(branch, revno)
- for propname, propvalue in revmeta.get_fileprops().items():
- if not propname.startswith(SVN_PROP_BZR_REVISION_ID):
- continue
- mapping_name = propname[len(SVN_PROP_BZR_REVISION_ID):]
- for line in propvalue.splitlines():
- try:
- revids.add((parse_revid_property(line), mapping_name))
- except InvalidPropertyValue, ie:
- mutter(str(ie))
+ for revid, revno, mapping_name in revmeta.get_roundtrip_ancestor_revids():
+ revids.add(((revno, revid), mapping_name))
except SubversionException, (_, ERR_FS_NOT_DIRECTORY):
- continue
+ continue
# If there are any new entries that are not yet in the cache,
# add them
from bzrlib.revision import NULL_REVISION, Revision
from bzrlib.plugins.svn import changes, core, errors as svn_errors, logwalker, properties
-from bzrlib.plugins.svn.mapping import is_bzr_revision_fileprops, is_bzr_revision_revprops, estimate_bzr_ancestors, SVN_REVPROP_BZR_SIGNATURE
+from bzrlib.plugins.svn.mapping import is_bzr_revision_fileprops, is_bzr_revision_revprops, estimate_bzr_ancestors, SVN_REVPROP_BZR_SIGNATURE, get_roundtrip_ancestor_revids
from bzrlib.plugins.svn.svk import (SVN_PROP_SVK_MERGE, svk_features_merged_since,
parse_svk_feature, estimate_svk_ancestors)
def get_fileid_map(self, mapping):
return mapping.import_fileid_map(self.get_revprops(), self.get_changed_fileprops())
+ def get_roundtrip_ancestor_revids(self):
+ if self.metabranch is not None and not self.metabranch.consider_bzr_fileprops(self):
+ # This revisions descendant doesn't have bzr fileprops set, so this one can't have them either.
+ return 0
+ return iter(get_roundtrip_ancestor_revids(self.get_fileprops()))
+
def __hash__(self):
return hash((self.__class__, self.uuid, self.branch_path, self.revnum))
from bzrlib.plugins.svn.auth import create_auth_baton
from bzrlib.plugins.svn.client import get_config
from bzrlib.plugins.svn.core import SubversionException
-from bzrlib.plugins.svn.errors import convert_svn_error, NoSvnRepositoryPresent, ERR_BAD_URL, ERR_RA_SVN_REPOS_NOT_FOUND, ERR_FS_ALREADY_EXISTS, ERR_FS_NOT_DIRECTORY, ERR_RA_DAV_RELOCATED, ERR_RA_DAV_PATH_NOT_FOUND
+from bzrlib.plugins.svn.errors import convert_svn_error, NoSvnRepositoryPresent, ERR_BAD_URL, ERR_RA_SVN_REPOS_NOT_FOUND, ERR_FS_ALREADY_EXISTS, ERR_FS_NOT_DIRECTORY, ERR_RA_DAV_RELOCATED, ERR_RA_DAV_PATH_NOT_FOUND, ERR_UNKNOWN_CAPABILITY
import urlparse
import urllib
try:
try:
self.capabilities[cap] = conn.has_capability(cap)
+ except SubversionException, (msg, num):
+ if num != ERR_UNKNOWN_CAPABILITY:
+ raise
+ self.capabilities[cap] = None
except NotImplementedError:
self.capabilities[cap] = None # None for unknown
return self.capabilities[cap]