Rev 333: Fix nested checkouts. in http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev
Jelmer Vernooij
jelmer at samba.org
Sat Dec 30 01:19:15 GMT 2006
------------------------------------------------------------
revno: 333
revision-id: jelmer at samba.org-20061230011810-h4o2wd05ntp7q0fj
parent: jelmer at samba.org-20061229211551-5f6dzb5dk7z59iqg
parent: jelmer at samba.org-20061229231829-2rwwhu07q2u774k8
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Sat 2006-12-30 02:18:10 +0100
message:
Fix nested checkouts.
modified:
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
fileids.py fileids.py-20060714013623-u5iiyqqnko11grcf-1
mapping.txt mapping.txt-20060625151311-9ghaqrm71ajq593n-1
tests/test_fileids.py test_fileids.py-20060622131341-19gyrlgqy8yl2od5-1
tests/test_repos.py test_repos.py-20060508151940-ddc49a59257ca712
------------------------------------------------------------
revno: 332.1.1
merged: jelmer at samba.org-20061229231829-2rwwhu07q2u774k8
parent: jelmer at samba.org-20061229211551-5f6dzb5dk7z59iqg
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Sat 2006-12-30 00:18:29 +0100
message:
Use checksums for the path in case the file id is too long (fixes #77453).
=== modified file 'fetch.py'
--- a/fetch.py 2006-12-29 20:30:40 +0000
+++ b/fetch.py 2006-12-30 01:18:10 +0000
@@ -358,21 +358,28 @@
edit, edit_baton = svn.delta.make_editor(editor, pool)
if parent_branch is None:
- transport.reparent(repos_root)
+ transport.reparent("%s/%s" % (repos_root, branch))
+ reporter, reporter_baton = transport.do_update(
+ revnum, "", True, edit, edit_baton, pool)
+
+ # Report status of existing paths
+ svn.ra.reporter2_invoke_set_path(reporter, reporter_baton,
+ "", revnum, True, None, pool)
else:
transport.reparent("%s/%s" % (repos_root, parent_branch))
- if parent_branch != branch:
- switch_url = "%s/%s" % (repos_root, branch)
- reporter, reporter_baton = transport.do_switch(
- revnum, "", True,
- switch_url, edit, edit_baton, pool)
- else:
- reporter, reporter_baton = transport.do_update(
- revnum, "", True, edit, edit_baton, pool)
-
- # Report status of existing paths
- svn.ra.reporter2_invoke_set_path(reporter, reporter_baton,
- "", parent_revnum, False, None, pool)
+
+ if parent_branch != branch:
+ switch_url = "%s/%s" % (repos_root, branch)
+ reporter, reporter_baton = transport.do_switch(
+ revnum, "", True,
+ switch_url, edit, edit_baton, pool)
+ else:
+ reporter, reporter_baton = transport.do_update(
+ revnum, "", True, edit, edit_baton, pool)
+
+ # Report status of existing paths
+ svn.ra.reporter2_invoke_set_path(reporter, reporter_baton,
+ "", parent_revnum, False, None, pool)
transport.lock()
svn.ra.reporter2_invoke_finish_report(reporter, reporter_baton, pool)
=== modified file 'fileids.py'
--- a/fileids.py 2006-12-29 19:21:54 +0000
+++ b/fileids.py 2006-12-29 23:18:29 +0000
@@ -24,6 +24,7 @@
from warnings import warn
import os
+import sha
import logwalker
from repository import (escape_svn_path, generate_svn_revision_id,
@@ -35,12 +36,19 @@
:param uuid: UUID of the repository
:param revnu: Revision number at which the file was introduced.
:param branch: Branch path of the branch in which the file was introduced.
- :param path: Original path of the file.
+ :param path: Original path of the file within the branch
"""
if path == "":
return ROOT_ID
introduced_revision_id = generate_svn_revision_id(uuid, revnum, branch)
- return "%s-%s" % (introduced_revision_id, escape_svn_path(path))
+ ret = "%s-%s" % (introduced_revision_id, escape_svn_path(path))
+ if len(ret) > 250:
+ basename = os.path.basename(path)
+ parent = path[:-len(basename)]
+ ret = "%s-%s-%s" % (introduced_revision_id,
+ sha.new(parent).hexdigest(),
+ escape_svn_path(basename))
+ return ret
def generate_file_id(revid, path):
=== modified file 'mapping.txt'
--- a/mapping.txt 2006-12-26 00:12:31 +0000
+++ b/mapping.txt 2006-12-29 23:18:29 +0000
@@ -83,6 +83,13 @@
If a file is being replaced by a copy of itself in an older revision it will
receive a new file id.
+If the file id generated is longer than 250 bytes, the following format will
+be used:
+
+<REVID>-<SHA1>-<FILENAME>
+
+where <SHA1> is the sha1 of the path to the directory name.
+
NEXT VERSION: Special rules are applied to make sure that renames are tracked.
== Properties ==
=== modified file 'tests/test_fileids.py'
--- a/tests/test_fileids.py 2006-12-29 19:21:54 +0000
+++ b/tests/test_fileids.py 2006-12-29 23:18:29 +0000
@@ -21,6 +21,8 @@
from bzrlib.trace import mutter
from bzrlib.tests import TestSkipped, TestCase
+import sha
+
import format
from fileids import SimpleFileIdMap, generate_file_id
from repository import MAPPING_VERSION
@@ -147,6 +149,19 @@
"svn-v%d:1@%s-trunk" % (MAPPING_VERSION, repository.uuid),
revid)
+def sha1(str):
+ return sha.new(str).hexdigest()
+
+class TestFileIdGenerator(TestCase):
+ def test_generate_file_id_path(self):
+ self.assertEqual("svn-v2:2 at uuid-bp-mypath",
+ generate_file_id("svn-v2:2 at uuid-bp", "mypath"))
+
+ def test_generate_file_id_long(self):
+ dir = "this/is/a" + ("/very"*40) + "/long/path/"
+ self.assertEqual("svn-v2:2 at uuid-bp-" + sha1(dir) + "-filename",
+ generate_file_id("svn-v2:2 at uuid-bp", dir+"filename"))
+
class TestFileMapping(TestCase):
def apply_mappings(self, mappings, find_children=None):
map = {}
=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py 2006-12-29 20:30:40 +0000
+++ b/tests/test_repos.py 2006-12-30 01:18:10 +0000
@@ -453,6 +453,17 @@
repository = Repository.open("svn+%s" % repos_url)
self.assertTrue(repository.is_shared())
+ def test_fetch_trunk1(self):
+ repos_url = self.make_client('d', 'dc')
+ self.build_tree({'dc/proj1/trunk/file': "data"})
+ self.client_add("dc/proj1")
+ self.client_commit("dc", "My Message")
+ oldrepos = Repository.open("dc")
+ oldrepos.set_branching_scheme(TrunkBranchingScheme(1))
+ dir = BzrDir.create("f")
+ newrepos = dir.create_repository()
+ oldrepos.copy_content_into(newrepos)
+
def test_fetch_delete(self):
repos_url = self.make_client('d', 'dc')
self.build_tree({'dc/foo/bla': "data"})
More information about the bazaar-commits
mailing list