Rev 587: Merge upstream. in file:///data/jelmer/bzr-svn/revprops/
Jelmer Vernooij
jelmer at samba.org
Mon Nov 5 14:14:32 GMT 2007
At file:///data/jelmer/bzr-svn/revprops/
------------------------------------------------------------
revno: 587
revision-id:jelmer at samba.org-20071105141430-m9wescan75jbts0c
parent: jelmer at samba.org-20071103165753-hjlzh40vohte7nmd
parent: jelmer at samba.org-20071105135214-1ka981pdv23k47db
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: revprops
timestamp: Mon 2007-11-05 15:14:30 +0100
message:
Merge upstream.
modified:
FAQ faq-20070910195147-p9u38s9wplds2d4o-1
NEWS news-20061231030336-h9fhq245ie0de8bs-1
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
logwalker.py logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
tests/test_commit.py test_commit.py-20060624213521-l5kcufywkh9mnilk-1
tests/test_logwalker.py test_logwalker.py-20060622141944-pkocc3rj8g62ukbi-1
tests/test_push.py test_push.py-20070201165715-g2ievcdfqi33wqsy-1
tests/test_repos.py test_repos.py-20060508151940-ddc49a59257ca712
transport.py transport.py-20060406231150-b3472d06b3a0818d
------------------------------------------------------------
revno: 579.1.203
revision-id:jelmer at samba.org-20071105135214-1ka981pdv23k47db
parent: jelmer at samba.org-20071105134626-uxjmzg0d4fgnr33v
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2007-11-05 14:52:14 +0100
message:
Properly escape commit message in repository.py as well - needs a common helper.
modified:
repository.py repository.py-20060306123302-1f8c5069b3fe0265
------------------------------------------------------------
revno: 579.1.202
revision-id:jelmer at samba.org-20071105134626-uxjmzg0d4fgnr33v
parent: jelmer at samba.org-20071105122445-n0nxjjba36l8wf82
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2007-11-05 14:46:26 +0100
message:
Properly decode unicode commit messages.
modified:
NEWS news-20061231030336-h9fhq245ie0de8bs-1
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
logwalker.py logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
tests/test_commit.py test_commit.py-20060624213521-l5kcufywkh9mnilk-1
tests/test_logwalker.py test_logwalker.py-20060622141944-pkocc3rj8g62ukbi-1
tests/test_push.py test_push.py-20070201165715-g2ievcdfqi33wqsy-1
tests/test_repos.py test_repos.py-20060508151940-ddc49a59257ca712
transport.py transport.py-20060406231150-b3472d06b3a0818d
------------------------------------------------------------
revno: 579.1.201
revision-id:jelmer at samba.org-20071105122445-n0nxjjba36l8wf82
parent: jelmer at samba.org-20071103185048-kzg43bie8g6xnxzj
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2007-11-05 13:24:45 +0100
message:
Docstring.
modified:
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
------------------------------------------------------------
revno: 579.1.200
revision-id:jelmer at samba.org-20071103185048-kzg43bie8g6xnxzj
parent: jelmer at samba.org-20071102143521-5bwaf2dkv1ar7ezp
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sat 2007-11-03 19:50:48 +0100
message:
Add entry to FAQ.
modified:
FAQ faq-20070910195147-p9u38s9wplds2d4o-1
=== modified file 'FAQ'
--- a/FAQ 2007-10-31 17:42:24 +0000
+++ b/FAQ 2007-11-03 18:50:48 +0000
@@ -89,3 +89,11 @@
You also need to enable support for this in bzr-svn by setting
override-svn-revprops to True in ~/.bazaar/bazaar.conf.
+
+==================================================================
+I converted my Subversion repository using svn-import, but now all
+branches are empty!
+==================================================================
+bzr-svn does not create working trees by default. If you need
+the working trees, run "bzr checkout" in the branch or
+specify --trees to svn-import.
=== modified file 'NEWS'
--- a/NEWS 2007-11-02 14:35:21 +0000
+++ b/NEWS 2007-11-05 13:46:26 +0000
@@ -1,5 +1,15 @@
bzr-svn 0.4.5 UNRELEASED
+ INTERNALS
+
+ * No longer store svn:author, svn:date and svn:log in the bzr-svn cache.
+ This should make it easier to use bzr-specific revprops later on and
+ saves some disk space.
+
+ BUG FIXES
+
+ * Properly decode unicode commit messages.
+
bzr-svn 0.4.4 2007-11-02
PERFORMANCE
=== modified file 'fetch.py'
--- a/fetch.py 2007-11-02 14:23:06 +0000
+++ b/fetch.py 2007-11-05 13:46:26 +0000
@@ -38,6 +38,27 @@
from tree import apply_txdelta_handler
+def _escape_commit_message(message):
+ """Replace xml-incompatible control characters."""
+ if message is None:
+ return None
+ import re
+ # FIXME: RBC 20060419 this should be done by the revision
+ # serialiser not by commit. Then we can also add an unescaper
+ # in the deserializer and start roundtripping revision messages
+ # precisely. See repository_implementations/test_repository.py
+
+ # Python strings can include characters that can't be
+ # represented in well-formed XML; escape characters that
+ # aren't listed in the XML specification
+ # (http://www.w3.org/TR/REC-xml/#NT-Char).
+ message, _ = re.subn(
+ u'[^\x09\x0A\x0D\u0020-\uD7FF\uE000-\uFFFD]+',
+ lambda match: match.group(0).encode('unicode_escape'),
+ message)
+ return message
+
+
def md5_strings(strings):
"""Return the MD5sum of the concatenation of strings.
@@ -88,18 +109,25 @@
# Commit SVN revision properties to a Revision object
rev = Revision(revision_id=revid, parent_ids=self._get_parent_ids())
- _svn_revprops = self.source._log.get_revision_info(self.revnum)
- if _svn_revprops[2] is not None:
+ svn_revprops = self.source._log._get_transport().revprop_list(self.revnum)
+ if svn_revprops.has_key(svn.core.SVN_PROP_REVISION_DATE):
rev.timestamp = 1.0 * svn.core.secs_from_timestr(
- _svn_revprops[2], None) #date
+ svn_revprops[svn.core.SVN_PROP_REVISION_DATE], None)
else:
rev.timestamp = 0 # FIXME: Obtain repository creation time
rev.timezone = None
- rev.committer = _svn_revprops[0] # author
- if rev.committer is None:
+ if svn_revprops.has_key(svn.core.SVN_PROP_REVISION_AUTHOR):
+ rev.committer = svn_revprops[svn.core.SVN_PROP_REVISION_AUTHOR]
+ else:
rev.committer = ""
- rev.message = _svn_revprops[1] # message
+ rev.message = svn_revprops.get(svn.core.SVN_PROP_REVISION_LOG)
+ if rev.message is not None:
+ assert isinstance(rev.message, str)
+ try:
+ rev.message = rev.message.decode("utf-8")
+ except UnicodeDecodeError:
+ pass
if self._revinfo:
parse_revision_metadata(self._revinfo, rev)
@@ -402,6 +430,8 @@
def _finish_commit(self):
rev = self._get_revision(self.revid)
self.inventory.revision_id = self.revid
+ # Escaping the commit message is really the task of the serialiser
+ rev.message = _escape_commit_message(rev.message)
rev.inventory_sha1 = osutils.sha_string(
self.target.serialise_inventory(self.inventory))
self.target.add_revision(self.revid, rev, self.inventory)
@@ -438,7 +468,11 @@
def get_revision_build_editor(repository):
- """Obtain a RevisionBuildEditor for a particular target repository."""
+ """Obtain a RevisionBuildEditor for a particular target repository.
+
+ :param repository: Repository to obtain the buildeditor for.
+ :return: Class object of class descending from RevisionBuildEditor
+ """
if hasattr(repository, '_packs'):
return PackRevisionBuildEditor
return WeaveRevisionBuildEditor
=== modified file 'logwalker.py'
--- a/logwalker.py 2007-10-23 18:18:20 +0000
+++ b/logwalker.py 2007-11-05 13:46:26 +0000
@@ -24,33 +24,10 @@
from transport import SvnRaTransport
import svn.core
-import base64
-
from cache import sqlite3
LOG_CHUNK_LIMIT = 1000
-def _escape_commit_message(message):
- """Replace xml-incompatible control characters."""
- if message is None:
- return None
- import re
- # FIXME: RBC 20060419 this should be done by the revision
- # serialiser not by commit. Then we can also add an unescaper
- # in the deserializer and start roundtripping revision messages
- # precisely. See repository_implementations/test_repository.py
-
- # Python strings can include characters that can't be
- # represented in well-formed XML; escape characters that
- # aren't listed in the XML specification
- # (http://www.w3.org/TR/REC-xml/#NT-Char).
- message, _ = re.subn(
- u'[^\x09\x0A\x0D\u0020-\uD7FF\uE000-\uFFFD]+',
- lambda match: match.group(0).encode('unicode_escape'),
- message)
- return message
-
-
class LogWalker(object):
"""Easy way to access the history of a Subversion repository."""
def __init__(self, transport, cache_db=None, limit=None):
@@ -76,7 +53,7 @@
self.db = cache_db
self.db.executescript("""
- create table if not exists revision(revno integer unique, author text, message text, date text);
+ create table if not exists revision(revno integer unique);
create unique index if not exists revision_revno on revision (revno);
create table if not exists changed_path(rev integer, action text, path text, copyfrom_path text, copyfrom_rev integer);
create index if not exists path_rev on changed_path(rev);
@@ -120,10 +97,7 @@
"replace into changed_path (rev, path, action, copyfrom_path, copyfrom_rev) values (?, ?, ?, ?, ?)",
(rev, p.strip("/"), orig_paths[p].action, copyfrom_path, orig_paths[p].copyfrom_rev))
- if message is not None:
- message = base64.b64encode(message)
-
- self.db.execute("replace into revision (revno, author, date, message) values (?,?,?,?)", (rev, author, date, message))
+ self.db.execute("replace into revision (revno) values (?)", (rev,))
self.saved_revnum = rev
if self.saved_revnum % 1000 == 0:
@@ -225,21 +199,6 @@
paths[p.encode("utf-8")] = (act, cf, cr)
return paths
- def get_revision_info(self, revnum):
- """Obtain basic information for a specific revision.
-
- :param revnum: Revision number.
- :returns: Tuple with author, log message and date of the revision.
- """
- assert revnum >= 0
- if revnum == 0:
- return (None, None, None)
- self.fetch_revisions(revnum)
- (author, message, date) = self.db.execute("select author, message, date from revision where revno="+ str(revnum)).fetchone()
- if message is not None:
- message = _escape_commit_message(base64.b64decode(message))
- return (author, message, date)
-
def find_latest_change(self, path, revnum, include_parents=False,
include_children=False):
"""Find latest revision that touched path.
=== modified file 'repository.py'
--- a/repository.py 2007-10-30 19:49:37 +0000
+++ b/repository.py 2007-11-05 13:52:14 +0000
@@ -631,12 +631,23 @@
# Commit SVN revision properties to a Revision object
rev = Revision(revision_id=revision_id, parent_ids=parent_ids)
- (rev.committer, rev.message, date) = self._log.get_revision_info(revnum)
- if rev.committer is None:
+ svn_revprops = self.transport.revprop_list(revnum)
+
+ if svn_revprops.has_key(svn.core.SVN_PROP_REVISION_AUTHOR):
+ rev.committer = svn_revprops[svn.core.SVN_PROP_REVISION_AUTHOR]
+ else:
rev.committer = ""
- if date is not None:
- rev.timestamp = 1.0 * svn.core.secs_from_timestr(date, None)
+ rev.message = svn_revprops.get(svn.core.SVN_PROP_REVISION_LOG)
+
+ if rev.message:
+ try:
+ rev.message = rev.message.decode("utf-8")
+ except UnicodeDecodeError:
+ pass
+
+ if svn_revprops.has_key(svn.core.SVN_PROP_REVISION_DATE):
+ rev.timestamp = 1.0 * svn.core.secs_from_timestr(svn_revprops[svn.core.SVN_PROP_REVISION_DATE], None)
else:
rev.timestamp = 0.0 # FIXME: Obtain repository creation time
rev.timezone = None
=== modified file 'tests/test_commit.py'
--- a/tests/test_commit.py 2007-11-01 01:33:04 +0000
+++ b/tests/test_commit.py 2007-11-05 13:46:26 +0000
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright (C) 2006-2007 Jelmer Vernooij <jelmer at samba.org>
# This program is free software; you can redistribute it and/or modify
@@ -97,14 +99,14 @@
self.build_tree({'dc/foo/bla': "data"})
self.client_add("dc/foo")
wt = self.open_checkout("dc")
- revid = wt.commit(message=u"\xe6\xf8\xe5")
+ revid = wt.commit(message=u"føø")
self.assertEqual(revid, wt.branch.generate_revision_id(1))
self.assertEqual(
wt.branch.generate_revision_id(1), wt.branch.last_revision())
new_revision = wt.branch.repository.get_revision(
wt.branch.last_revision())
self.assertEqual(wt.branch.last_revision(), new_revision.revision_id)
- self.assertEqual(u"\xe6\xf8\xe5", new_revision.message.decode("utf-8"))
+ self.assertEqual(u"føø", new_revision.message)
def test_commit_update(self):
self.make_client('d', 'dc')
@@ -379,7 +381,7 @@
repos = self.olddir.find_repository()
self.assertEqual(u"\xe6\xf8\xe5", repos.get_revision(
- repos.generate_revision_id(2, "", "none")).message.decode("utf-8"))
+ repos.generate_revision_id(2, "", "none")).message)
def test_commit_rename_file(self):
self.build_tree({'dc/vla': "data"})
=== modified file 'tests/test_logwalker.py'
--- a/tests/test_logwalker.py 2007-10-20 16:52:14 +0000
+++ b/tests/test_logwalker.py 2007-11-05 13:46:26 +0000
@@ -464,30 +464,6 @@
self.assertEqual(("trunk", 1), walker.get_previous("anotherfile", 2))
- def test_get_revision_info_zero(self):
- repos_url = self.make_client("a", "dc")
-
- walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))
-
- info = walker.get_revision_info(0)
-
- self.assertEqual(None, info[0])
- self.assertEqual(None, info[1])
- self.assertEqual(None, info[2])
-
- def test_get_revision_info(self):
- repos_url = self.make_client("a", "dc")
- self.build_tree({'dc/trunk/afile': "data"})
- self.client_add("dc/trunk")
- self.client_commit("dc", "My Message")
-
- walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))
-
- info = walker.get_revision_info(1)
-
- self.assertEqual("", info[0])
- self.assertEqual("My Message", info[1])
-
def test_find_children_empty(self):
repos_url = self.make_client("a", "dc")
self.build_tree({'dc/trunk': None})
=== modified file 'tests/test_push.py'
--- a/tests/test_push.py 2007-10-30 22:08:13 +0000
+++ b/tests/test_push.py 2007-11-05 13:46:26 +0000
@@ -471,6 +471,18 @@
self.assertEquals(u"Adeodato Simó <dato at net.com.org.es>",
Repository.open(repos_url).get_revision(revid1).committer)
+ def test_utf8_commit_msg(self):
+ repos_url = self.make_client("a", "dc")
+ bzrwt = BzrDir.create_standalone_workingtree("c",
+ format=format.get_rich_root_format())
+ self.build_tree({'c/foo.txt': "foo"})
+ bzrwt.add("foo.txt")
+ revid1 = bzrwt.commit(u"Do á commït")
+ newdir = BzrDir.open(repos_url+"/trunk")
+ newdir.import_branch(bzrwt.branch)
+ self.assertEquals(u"Do á commït",
+ Repository.open(repos_url).get_revision(revid1).message)
+
def test_multiple_part_exists(self):
repos_url = self.make_client("a", "dc")
self.build_tree({'dc/trunk/myfile': "data", 'dc/branches': None})
=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py 2007-10-30 19:49:37 +0000
+++ b/tests/test_repos.py 2007-11-05 13:46:26 +0000
@@ -539,7 +539,6 @@
self.assertEqual("", rev.committer)
self.assertEqual({}, rev.properties)
self.assertEqual(None, rev.timezone)
- self.assertEqual(0.0, rev.timestamp)
def test_store_branching_scheme(self):
repos_url = self.make_client('d', 'dc')
@@ -969,7 +968,7 @@
rev = newrepos.get_revision(
oldrepos.generate_revision_id(2, "trunk", "trunk0"))
- self.assertEqual(u'bla\xfcbla', rev.message)
+ self.assertEqual('bla\xc3\xbcbla', rev.message.encode("utf-8"))
rev = newrepos.get_revision(oldrepos.generate_revision_id(3, "trunk", "trunk0"))
self.assertEqual(u"a\\x0cb", rev.message)
=== modified file 'transport.py'
--- a/transport.py 2007-10-30 21:10:26 +0000
+++ b/transport.py 2007-11-05 13:46:26 +0000
@@ -475,6 +475,11 @@
return has_attr(svn.ra, 'get_commit_editor3')
@convert_svn_error
+ def revprop_list(self, revnum, pool=None):
+ self.mutter('svn revprop-list -r %r' % revnum)
+ return svn.ra.rev_proplist(self._ra, revnum, pool)
+
+ @convert_svn_error
def get_commit_editor(self, revprops, done_cb, lock_token, keep_locks):
self._open_real_transport()
self._mark_busy()
More information about the bazaar-commits
mailing list