Rev 1912: Merge trunk. in file:///data/jelmer/bzr-svn/trunk/
Jelmer Vernooij
jelmer at samba.org
Wed Sep 17 12:00:31 BST 2008
At file:///data/jelmer/bzr-svn/trunk/
------------------------------------------------------------
revno: 1912
revision-id: jelmer at samba.org-20080917110014-0y2yzvi6ur8zo7wm
parent: jelmer at samba.org-20080917105703-8ytshp9uens2y3ry
parent: jelmer at samba.org-20080915044737-wwamrkstr5qpenoc
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Wed 2008-09-17 13:00:14 +0200
message:
Merge trunk.
modified:
NEWS news-20061231030336-h9fhq245ie0de8bs-1
__init__.py __init__.py-20051008155114-eae558e6cf149e1d
branch.py svnbranch.py-20051017135706-11c749eb0dab04a7
config.py config.py-20070624185721-0j8f1ly75uo4s1lk-1
convert.py svn2bzr.py-20051018015439-cb4563bff29e632d
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
layout/__init__.py layout.py-20080323165407-y9qw8nx4oykvoe1k-1
layout/standard.py standard.py-20080909185308-vfoi9po1pzy6u4le-2
logwalker.py logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
------------------------------------------------------------
revno: 1910.1.4
revision-id: jelmer at samba.org-20080915044737-wwamrkstr5qpenoc
parent: jelmer at samba.org-20080915042621-o9xf1kh6rrj2die2
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Mon 2008-09-15 06:47:37 +0200
message:
Add svn-layout command.
modified:
__init__.py __init__.py-20051008155114-eae558e6cf149e1d
------------------------------------------------------------
revno: 1910.1.3
revision-id: jelmer at samba.org-20080915042621-o9xf1kh6rrj2die2
parent: jelmer at samba.org-20080914214132-nok8ifajnezxs0nm
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Mon 2008-09-15 06:26:21 +0200
message:
Add --until option to svn-import.
modified:
NEWS news-20061231030336-h9fhq245ie0de8bs-1
__init__.py __init__.py-20051008155114-eae558e6cf149e1d
branch.py svnbranch.py-20051017135706-11c749eb0dab04a7
convert.py svn2bzr.py-20051018015439-cb4563bff29e632d
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
------------------------------------------------------------
revno: 1910.1.2
revision-id: jelmer at samba.org-20080914214132-nok8ifajnezxs0nm
parent: jelmer at samba.org-20080913015247-jajh02avguu9d62a
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sun 2008-09-14 23:41:32 +0200
message:
Fix some tests, allow specifying layout in configuration file.
modified:
__init__.py __init__.py-20051008155114-eae558e6cf149e1d
config.py config.py-20070624185721-0j8f1ly75uo4s1lk-1
layout/__init__.py layout.py-20080323165407-y9qw8nx4oykvoe1k-1
layout/standard.py standard.py-20080909185308-vfoi9po1pzy6u4le-2
logwalker.py logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
------------------------------------------------------------
revno: 1910.1.1
revision-id: jelmer at samba.org-20080913015247-jajh02avguu9d62a
parent: jelmer at samba.org-20080912110224-v0tlqt9gmhb6fgzw
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sat 2008-09-13 03:52:47 +0200
message:
Fix finding branches.
modified:
convert.py svn2bzr.py-20051018015439-cb4563bff29e632d
=== modified file 'NEWS'
--- a/NEWS 2008-09-09 21:25:51 +0000
+++ b/NEWS 2008-09-15 04:26:21 +0000
@@ -30,6 +30,8 @@
* Also upgrade fileids in workingtree during svn-upgrade.
+ * Add --until option to svn-import.
+
BUG FIXES
* Set bzr signature revision property during commit if possible.
=== modified file '__init__.py'
--- a/__init__.py 2008-09-17 10:57:03 +0000
+++ b/__init__.py 2008-09-17 11:00:14 +0000
@@ -210,18 +210,19 @@
help="Import revisions incrementally."),
Option('prefix', type=str,
help='Only consider branches of which path starts '
- 'with prefix.')
+ 'with prefix.'),
+ Option('until', type=int,
+ help="Only import revisions up to specified Subversion revnum"),
]
@display_command
def run(self, from_location, to_location=None, trees=False,
standalone=False, layout=None, all=False, prefix=None, keep=False,
- incremental=False):
+ incremental=False, until=None):
from bzrlib.bzrdir import BzrDir
from bzrlib.errors import BzrCommandError, NoRepositoryPresent
from bzrlib import osutils, urlutils
from bzrlib.plugins.svn.convert import convert_repository
- from bzrlib.plugins.svn.layout.guess import repository_guess_layout
from bzrlib.plugins.svn.repository import SvnRepository
from bzrlib.trace import info
@@ -253,16 +254,18 @@
prefix = urlutils.relative_url(from_repos.base, from_location)
prefix = prefix.encode("utf-8")
- to_revnum = from_repos.get_latest_revnum()
+ if until is None:
+ to_revnum = from_repos.get_latest_revnum()
+ else:
+ to_revnum = min(until, from_repos.get_latest_revnum())
from_repos.lock_read()
try:
- (guessed_overall_layout, _) = repository_guess_layout(from_repos,
- to_revnum)
+ guessed_overall_layout = from_repos.get_guessed_layout()
if prefix is not None:
prefix = prefix.strip("/") + "/"
- if guessed_overall__layout.is_branch(prefix):
+ if guessed_overall_layout.is_branch(prefix):
raise BzrCommandError("%s appears to contain a branch. "
"For individual branches, use 'bzr branch'." %
from_location)
@@ -525,6 +528,19 @@
register_command(cmd_svn_set_revprops)
+class cmd_svn_layout(Command):
+
+ takes_args = ["repos_url"]
+
+ def run(self, repos_url):
+ from bzrlib.repository import Repository
+
+ repos = Repository.open(repos_url)
+ layout = repos.get_layout()
+ self.outf.write("Layout: %s\n" % str(layout))
+
+register_command(cmd_svn_layout)
+
def test_suite():
"""Returns the testsuite for bzr-svn."""
from unittest import TestSuite
=== modified file 'branch.py'
--- a/branch.py 2008-09-09 11:32:56 +0000
+++ b/branch.py 2008-09-15 04:26:21 +0000
@@ -39,7 +39,7 @@
class SvnBranch(Branch):
"""Maps to a Branch in a Subversion repository """
- def __init__(self, repository, branch_path, _skip_check=False):
+ def __init__(self, repository, branch_path, revnum=None, _skip_check=False):
"""Instantiate a new SvnBranch.
:param repos: SvnRepository this branch is part of.
@@ -61,10 +61,11 @@
self.base = urlutils.join(self.repository.base,
self._branch_path).rstrip("/")
self._revmeta_cache = None
+ self._revnum = revnum
assert isinstance(self._branch_path, str)
if not _skip_check:
try:
- revnum = self.repository.get_latest_revnum()
+ revnum = self._revnum or self.repository.get_latest_revnum()
if self.repository.transport.check_path(self._branch_path,
revnum) != core.NODE_DIR:
raise NotBranchError(self.base)
@@ -317,7 +318,7 @@
if self._revmeta_cache is None:
pb = ui.ui_factory.nested_progress_bar()
try:
- self._revmeta_cache = self.repository._revmeta_provider.get_mainline(self.get_branch_path(), self.repository.get_latest_revnum(), self.mapping, pb=pb)
+ self._revmeta_cache = self.repository._revmeta_provider.get_mainline(self.get_branch_path(), self._revnum or self.repository.get_latest_revnum(), self.mapping, pb=pb)
finally:
pb.finished()
return self._revmeta_cache
=== modified file 'config.py'
--- a/config.py 2008-09-04 11:47:09 +0000
+++ b/config.py 2008-09-14 21:41:32 +0000
@@ -57,6 +57,15 @@
self.get_user_option('branching-scheme-mandatory') is not None):
self.set_user_option('branching-scheme-mandatory', str(mandatory))
+ def get_layout(self):
+ return self._get_user_option("layout", use_global=False)
+
+ def get_branches(self):
+ return self._get_user_option("branches", use_global=False)
+
+ def get_tags(self):
+ return self._get_user_option("tags", use_global=False)
+
def _get_user_option(self, name, use_global=True):
try:
return self._get_parser()[self.uuid][name]
=== modified file 'convert.py'
--- a/convert.py 2008-09-11 18:37:35 +0000
+++ b/convert.py 2008-09-15 04:26:21 +0000
@@ -182,30 +182,24 @@
else:
removed_branches = []
mapping = source_repos.get_mapping()
- if from_revnum > 0:
- revmetas = []
- existing_branches = {}
- pb = ui.ui_factory.nested_progress_bar()
- try:
- for revmeta in source_repos._revmeta_provider.iter_all_changes(layout, mapping,
- to_revnum, from_revnum,
- project=project):
- pb.update("determining revisions to fetch", to_revnum-revmeta.revnum, to_revnum)
- if revmeta.is_hidden(mapping):
- continue
- if target_repos is not None and not target_repos.has_revision(revmeta.get_revision_id(mapping)):
- revmetas.append(revmeta)
- if not revmeta.branch_path in existing_branches:
- existing_branches[revmeta.branch_path] = SvnBranch(source_repos, revmeta.branch_path, _skip_check=True)
- finally:
- pb.finished()
- existing_branches = existing_branches.keys()
- else:
- existing_branches = source_repos.find_branches(layout, to_revnum)
- revmetas = None
-
- if filter_branch is not None:
- existing_branches = filter(filter_branch, existing_branches)
+ revmetas = []
+ existing_branches = {}
+ pb = ui.ui_factory.nested_progress_bar()
+ # FIXME: Use filter_branch
+ try:
+ for revmeta in source_repos._revmeta_provider.iter_all_changes(layout, mapping,
+ to_revnum, from_revnum,
+ project=project):
+ pb.update("determining revisions to fetch", to_revnum-revmeta.revnum, to_revnum)
+ if revmeta.is_hidden(mapping):
+ continue
+ if target_repos is not None and not target_repos.has_revision(revmeta.get_revision_id(mapping)):
+ revmetas.append(revmeta)
+ if not revmeta.branch_path in existing_branches:
+ existing_branches[revmeta.branch_path] = SvnBranch(source_repos, revmeta.branch_path, revnum=revmeta.revnum, _skip_check=True)
+ finally:
+ pb.finished()
+ existing_branches = existing_branches.values()
if create_shared_repo:
inter = InterRepository.get(source_repos, target_repos)
@@ -215,7 +209,8 @@
elif (target_repos.is_shared() and
getattr(inter, '_supports_branches', None) and
inter._supports_branches):
- inter.fetch(branches=existing_branches, revmetas=revmetas, mapping=source_repos.get_mapping())
+ revmetas.reverse()
+ inter.fetch(revmetas=revmetas, mapping=source_repos.get_mapping())
if not keep:
# Remove removed branches
=== modified file 'fetch.py'
--- a/fetch.py 2008-09-08 05:00:58 +0000
+++ b/fetch.py 2008-09-15 04:26:21 +0000
@@ -612,24 +612,6 @@
needed = list(graph.iter_topo_order(missing))
return [(meta_map[revid], mapping) for revid in needed]
- def _find_branches(self, branches, find_ghosts=False, pb=None):
- set_needed = set()
- ret_needed = list()
- checked = set()
- for branch in branches:
- if pb:
- pb.update("determining revisions to fetch", branches.index(branch), len(branches))
- try:
- nestedpb = ui.ui_factory.nested_progress_bar()
- for rev in self._find_until(branch.last_revision(), find_ghosts=find_ghosts,
- pb=nestedpb, checked=checked, project=branch.project):
- if rev[0] not in set_needed:
- ret_needed.append(rev)
- set_needed.add(rev[0])
- finally:
- nestedpb.finished()
- return ret_needed
-
def _find_until(self, revision_id, find_ghosts=False, pb=None,
checked=None, project=None):
"""Find all missing revisions until revision_id
@@ -786,7 +768,7 @@
self.target.commit_write_group()
def fetch(self, revision_id=None, pb=None, find_ghosts=False,
- branches=None, revmetas=None, mapping=None):
+ revmetas=None, mapping=None):
"""Fetch revisions. """
if revision_id == NULL_REVISION:
return
@@ -807,9 +789,6 @@
try:
if revmetas is not None:
needed = [(revmeta, mapping) for revmeta in revmetas]
- elif branches is not None:
- needed = self._find_branches(branches, find_ghosts,
- pb=nested_pb)
elif revision_id is None:
needed = self._find_all(self.source.get_mapping(), pb=nested_pb)
else:
=== modified file 'layout/__init__.py'
--- a/layout/__init__.py 2008-09-11 17:55:11 +0000
+++ b/layout/__init__.py 2008-09-14 21:41:32 +0000
@@ -233,7 +233,15 @@
layout_registry.register_lazy("itrunk3", "bzrlib.plugins.svn.layout.standard",
"InverseTrunkLayout3")
-repository_registry = registry.Registry()
+class RepositoryRegistry(registry.Registry):
+
+ def get(self, name):
+ try:
+ return super(RepositoryRegistry, self).get(name)()
+ except KeyError:
+ return None
+
+repository_registry = RepositoryRegistry()
# KDE:
repository_registry.register_lazy("283d02a7-25f6-0310-bc7c-ecb5cbfe19da",
"bzrlib.plugins.svn.layout.standard", "InverseTrunkLayout1")
=== modified file 'layout/standard.py'
--- a/layout/standard.py 2008-09-11 17:55:11 +0000
+++ b/layout/standard.py 2008-09-14 21:41:32 +0000
@@ -359,21 +359,6 @@
return "%s(%r,%r)" % (self.__class__.__name__, self.branches, self.tags)
-class ConfigBasedLayout(WildcardLayout):
-
- def _get_list(self, name):
- try:
- return self._config.get_user_option(name).split(";")
- except TypeError:
- return []
-
- def __init__(self, repository):
- self.repository = repository
- self._config = repository.get_config()
- super(ConfigBasedLayout, self).__init__(self._get_list("branches"),
- self._get_list("tags"))
-
-
class InverseTrunkLayout(RepositoryLayout):
def __init__(self, level):
=== modified file 'logwalker.py'
--- a/logwalker.py 2008-09-07 00:00:07 +0000
+++ b/logwalker.py 2008-09-14 21:41:32 +0000
@@ -187,7 +187,8 @@
:param name: Name of the revision property.
:param value: Contents of the revision property.
"""
- self.cachedb.execute("replace into revprop (rev, name, value) values (?, ?, ?)", (rev, name.decode("utf-8"), value.decode("utf-8")))
+ assert isinstance(name, str) and isinstance(value, str)
+ self.cachedb.execute("replace into revprop (rev, name, value) values (?, ?, ?)", (rev, name.decode("utf-8", "replace"), value.decode("utf-8", "replace")))
def insert_revprops(self, revision, revprops):
if revprops is None:
=== modified file 'repository.py'
--- a/repository.py 2008-09-12 11:02:24 +0000
+++ b/repository.py 2008-09-14 21:41:32 +0000
@@ -36,6 +36,7 @@
from bzrlib.plugins.svn.branchprops import PathPropertyProvider
from bzrlib.plugins.svn.config import SvnRepositoryConfig
from bzrlib.plugins.svn.core import SubversionException
+from bzrlib.plugins.svn.layout.standard import WildcardLayout
from bzrlib.plugins.svn.layout.guess import repository_guess_layout
from bzrlib.plugins.svn.mapping import (SVN_REVPROP_BZR_SIGNATURE,
SVN_REVPROP_BZR_TAGS,
@@ -291,10 +292,16 @@
if self._layout is None:
self._layout = self.get_mapping().get_mandated_layout(self)
if self._layout is None:
- try:
- self._layout = layout.repository_registry.get(self.uuid)()
- except KeyError:
- pass
+ layoutname = self.get_config().get_layout()
+ if layoutname is not None:
+ self._layout = mapping_registry.get(layoutname)()
+ if self._layout is None:
+ branches = self.get_config().get_branches()
+ tags = self.get_config().get_tags()
+ if branches is not None:
+ self._layout = WildcardLayout(branches, tags)
+ if self._layout is None:
+ self._layout = layout.repository_registry.get(self.uuid)
if self._layout is None:
(self._guessed_layout, self._layout) = repository_guess_layout(self,
self.get_latest_revnum(), self._hinted_branch_path)
@@ -534,7 +541,7 @@
at the moment.
"""
try:
- revmeta = self._get_revmeta(revision_id)
+ revmeta, mapping = self._get_revmeta(revision_id)
except NoSuchRevision:
return False
return revmeta.get_signature() is not None
@@ -546,7 +553,7 @@
signature.
:raises NoSuchRevision: Always
"""
- revmeta = self._get_revmeta(revision_id)
+ revmeta, mapping = self._get_revmeta(revision_id)
signature = revmeta.get_signature()
if signature is None:
raise NoSuchRevision(self, revision_id)
More information about the bazaar-commits
mailing list