Rev 453: merge 0.4 in file:///data/jelmer/bzr-svn/nestedtrees/
Jelmer Vernooij
jelmer at samba.org
Tue Mar 18 19:47:45 GMT 2008
At file:///data/jelmer/bzr-svn/nestedtrees/
------------------------------------------------------------
revno: 453
revision-id:jelmer at samba.org-20080318194744-0k00tza6zh9bd82l
parent: jelmer at samba.org-20080318175024-egfahp63avcl1fri
parent: jelmer at samba.org-20080318194550-jea4hwu2jqshsq9c
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: nestedtrees
timestamp: Tue 2008-03-18 20:47:44 +0100
message:
merge 0.4
modified:
Makefile makefile.other-20080311181537-5svhje3v1flh1n4f-1
__init__.py __init__.py-20051008155114-eae558e6cf149e1d
branch.py svnbranch.py-20051017135706-11c749eb0dab04a7
tests/test_tree.py test_tree.py-20070103204350-pr8nupes7e5sd2wr-1
tree.py tree.py-20060624222557-dudlwqcmkf22lt2s-1
------------------------------------------------------------
revno: 438.6.326
revision-id:jelmer at samba.org-20080318194550-jea4hwu2jqshsq9c
parent: jelmer at samba.org-20080316041437-dutaq8lj04m44pd5
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2008-03-18 20:45:50 +0100
message:
Cherrypick utility functions for svn:externals support.
modified:
branch.py svnbranch.py-20051017135706-11c749eb0dab04a7
errors.py errors.py-20061226172623-w1sbj8ynpo0eojqp-1
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
tests/test_tree.py test_tree.py-20070103204350-pr8nupes7e5sd2wr-1
tree.py tree.py-20060624222557-dudlwqcmkf22lt2s-1
------------------------------------------------------------
revno: 438.6.325
revision-id:jelmer at samba.org-20080316041437-dutaq8lj04m44pd5
parent: jelmer at samba.org-20080315160050-9h1i4rm171xg4g6d
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sun 2008-03-16 05:14:37 +0100
message:
Mark as only compatible with >= 1.3
modified:
__init__.py __init__.py-20051008155114-eae558e6cf149e1d
------------------------------------------------------------
revno: 438.6.324
revision-id:jelmer at samba.org-20080315160050-9h1i4rm171xg4g6d
parent: jelmer at samba.org-20080312190525-6yyhiqt4f5t1kbhm
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sat 2008-03-15 17:00:50 +0100
message:
Make it easier to run in a debugger.
modified:
Makefile makefile.other-20080311181537-5svhje3v1flh1n4f-1
=== modified file 'Makefile'
--- a/Makefile 2008-03-11 18:16:09 +0000
+++ b/Makefile 2008-03-15 16:00:50 +0000
@@ -1,14 +1,20 @@
-BZR ?= bzr
+DEBUGGER ?=
+BZR ?= $(shell which bzr)
+PYTHON ?= $(shell which python)
SETUP ?= ./setup.py
PYDOCTOR ?= pydoctor
-CTAGS = ?= ctags
+CTAGS ?= ctags
PYLINT ?= pylint
+TESTS ?= svn
all:: build
build::
$(SETUP) build
+build-inplace::
+ $(SETUP) build_ext --inplace
+
install::
$(SETUP) install
@@ -20,11 +26,11 @@
$(TMP_PLUGINS_DIR):
mkdir -p $@
-$(TMP_PLUGINS_DIR)/svn: $(TMP_PLUGINS_DIR)
+$(TMP_PLUGINS_DIR)/svn: build-inplace $(TMP_PLUGINS_DIR)
ln -sf `pwd` $(TMP_PLUGINS_DIR)/svn
check:: $(TMP_PLUGINS_DIR)/svn
- BZR_PLUGIN_PATH=$(TMP_PLUGINS_DIR) $(BZR) selftest $(TEST_OPTIONS) svn
+ BZR_PLUGIN_PATH=$(TMP_PLUGINS_DIR) $(DEBUGGER) $(PYTHON) $(BZR) selftest $(TEST_OPTIONS) $(TESTS)
check-verbose::
$(MAKE) check TEST_OPTIONS=-v
@@ -32,6 +38,9 @@
check-one::
$(MAKE) check TEST_OPTIONS=--one
+show-plugins::
+ BZR_PLUGIN_PATH=$(TMP_PLUGINS_DIR) $(BZR) plugins
+
lint::
$(PYLINT) -f parseable *.py */*.py
=== modified file '__init__.py'
--- a/__init__.py 2008-03-18 17:49:44 +0000
+++ b/__init__.py 2008-03-18 19:47:44 +0000
@@ -39,7 +39,7 @@
version_string = '%d.%d.%d%s%d' % version_info
__version__ = version_string
-COMPATIBLE_BZR_VERSIONS = [(0, 93), (1, 0), (1, 1), (1, 2)]
+COMPATIBLE_BZR_VERSIONS = [(1, 3)]
def check_bzrlib_version(desired):
"""Check that bzrlib is compatible.
=== modified file 'branch.py'
--- a/branch.py 2008-03-18 17:49:44 +0000
+++ b/branch.py 2008-03-18 19:47:44 +0000
@@ -73,6 +73,7 @@
self._revision_history_revnum = None
self.mapping = self.repository.get_mapping()
self._branch_path = branch_path.strip("/")
+ assert isinstance(self._branch_path, str)
try:
if self.repository.transport.check_path(branch_path.strip("/"),
self.get_revnum()) != svn.core.svn_node_dir:
@@ -128,11 +129,12 @@
"""
return BranchCheckResult(self)
- def _create_heavyweight_checkout(self, to_location, revision_id=None):
+ def _create_heavyweight_checkout(self, to_location, revision_id=None, hardlink=False):
"""Create a new heavyweight checkout of this branch.
:param to_location: URL of location to create the new checkout in.
:param revision_id: Revision that should be the tip of the checkout.
+ :param hardlink: Whether to hardlink
:return: WorkingTree object of checkout.
"""
checkout_branch = BzrDir.create_branch_convenience(
@@ -142,7 +144,7 @@
# pull up to the specified revision_id to set the initial
# branch tip correctly, and seed it with history.
checkout_branch.pull(self, stop_revision=revision_id)
- return checkout.create_workingtree(revision_id)
+ return checkout.create_workingtree(revision_id, hardlink=hardlink)
def lookup_revision_id(self, revid):
"""Look up the matching Subversion revision number on the mainline of
@@ -183,12 +185,12 @@
return WorkingTree.open(to_location)
def create_checkout(self, to_location, revision_id=None, lightweight=False,
- accelerator_tree=None):
+ accelerator_tree=None, hardlink=False):
"""See Branch.create_checkout()."""
if lightweight:
return self._create_lightweight_checkout(to_location, revision_id)
else:
- return self._create_heavyweight_checkout(to_location, revision_id)
+ return self._create_heavyweight_checkout(to_location, revision_id, hardlink=hardlink)
def generate_revision_id(self, revnum):
"""Generate a new revision id for a revision on this branch."""
@@ -231,6 +233,13 @@
last_revid = self.last_revision()
return self.revision_id_to_revno(last_revid), last_revid
+ def get_root_id(self, revnum=None):
+ if revnum is None:
+ tree = self.basis_tree()
+ else:
+ tree = self.repository.revision_tree(self.get_rev_id(revnum))
+ return tree.get_root_id()
+
def revno(self):
"""See Branch.revno()."""
return self.last_revision_info()[0]
=== modified file 'tests/test_tree.py'
--- a/tests/test_tree.py 2008-03-18 17:49:44 +0000
+++ b/tests/test_tree.py 2008-03-18 19:47:44 +0000
@@ -18,13 +18,12 @@
from bzrlib.inventory import Inventory, TreeReference
from bzrlib.osutils import has_symlinks
from bzrlib.repository import Repository
+from bzrlib.revision import NULL_REVISION
from bzrlib.tests import TestCase
from bzrlib.workingtree import WorkingTree
import errors
-from fileids import generate_svn_file_id
import os
-from revids import generate_svn_revision_id
from tree import (SvnBasisTree, parse_externals_description,
inventory_add_external)
import sys
@@ -111,7 +110,6 @@
self.assertFalse(tree.inventory[tree.inventory.path2id("file")].executable)
self.assertFalse(wt.inventory[wt.inventory.path2id("file")].executable)
-
class TestExternalsParser(TestCase):
def test_parse_externals(self):
self.assertEqual({
@@ -157,44 +155,45 @@
"""Add a nested tree with no specific revision referenced."""
repos_url = self.make_client('d', 'dc')
repos = Repository.open(repos_url)
+ mapping = repos.get_mapping()
inv = Inventory(root_id='blabloe')
inventory_add_external(inv, 'blabloe', 'blie/bla',
- generate_svn_revision_id(repos.uuid, 1, "", "none"),
+ mapping.generate_revision_id(repos.uuid, 1, ""),
None, repos_url)
self.assertEqual(TreeReference(
- generate_svn_file_id(repos.uuid, 0, "", ""),
+ mapping.generate_file_id(repos.uuid, 0, "", u""),
'bla', inv.path2id('blie'),
- revision=generate_svn_revision_id(repos.uuid, 1, "", "none")),
+ revision=mapping.generate_revision_id(repos.uuid, 1, "")),
inv[inv.path2id('blie/bla')])
def test_add_simple_norev(self):
repos_url = self.make_client('d', 'dc')
repos = Repository.open(repos_url)
+ mapping = repos.get_mapping()
inv = Inventory(root_id='blabloe')
inventory_add_external(inv, 'blabloe', 'bla',
- generate_svn_revision_id(repos.uuid, 1, "", "none"), None,
+ mapping.generate_revision_id(repos.uuid, 1, ""), None,
repos_url)
self.assertEqual(TreeReference(
- generate_svn_file_id(repos.uuid, 0, "", ""),
+ mapping.generate_file_id(repos.uuid, 0, "", u""),
'bla', 'blabloe',
- revision=generate_svn_revision_id(repos.uuid, 1, "", "none")),
+ revision=mapping.generate_revision_id(repos.uuid, 1, "")),
inv[inv.path2id('bla')])
def test_add_simple_rev(self):
repos_url = self.make_client('d', 'dc')
repos = Repository.open(repos_url)
inv = Inventory(root_id='blabloe')
+ mapping = repos.get_mapping()
inventory_add_external(inv, 'blabloe', 'bla',
- generate_svn_revision_id(repos.uuid, 1, "", "none"), 0, repos_url)
- self.assertEqual(
- TreeReference(generate_svn_file_id(repos.uuid, 0, "", ""),
+ mapping.generate_revision_id(repos.uuid, 1, ""), 0, repos_url)
+ expected_ie = TreeReference(mapping.generate_file_id(repos.uuid, 0, "", u""),
'bla', 'blabloe',
- revision=generate_svn_revision_id(repos.uuid, 1, "", "none"),
- reference_revision=generate_svn_revision_id(repos.uuid, 0, "", "none")
- ), inv[inv.path2id('bla')])
+ revision=mapping.generate_revision_id(repos.uuid, 1, ""),
+ reference_revision=NULL_REVISION)
ie = inv[inv.path2id('bla')]
- self.assertEqual(generate_svn_revision_id(repos.uuid, 0, "", "none"),
- ie.reference_revision)
- self.assertEqual(generate_svn_revision_id(repos.uuid, 1, "", "none"),
+ self.assertEqual(NULL_REVISION, ie.reference_revision)
+ self.assertEqual(mapping.generate_revision_id(repos.uuid, 1, ""),
ie.revision)
+ self.assertEqual(expected_ie, inv[inv.path2id('bla')])
=== modified file 'tree.py'
--- a/tree.py 2008-03-18 17:49:44 +0000
+++ b/tree.py 2008-03-18 19:47:44 +0000
@@ -90,8 +90,7 @@
file_id = reference_branch.get_root_id()
ie = TreeReference(file_id, name, parent.file_id, revision=revid)
if ref_revnum is not None:
- ie.reference_revision = reference_branch.generate_revision_id(
- ref_revnum)
+ ie.reference_revision = reference_branch.get_rev_id(ref_revnum)
inv.add(ie)
More information about the bazaar-commits
mailing list