Commit d3a5c5ec authored by Jelmer Vernooij's avatar Jelmer Vernooij

Show subversion revision numbers in bzr log.

parent 11817b07
......@@ -34,6 +34,8 @@ bzr-svn 0.4.11 UNRELEASED
* Avoid reopening connections to branch and repository when finding branches. (#243749)
* Show Subversion revision numbers in log output. (#161830)
BUG FIXES
* Now uses absolute imports and no longer adds plugin directory to the system path.
......
......@@ -18,6 +18,7 @@
Support for Subversion branches
"""
import bzrlib
from bzrlib import log
from bzrlib.bzrdir import BzrDirFormat, format_registry
from bzrlib.errors import BzrError
from bzrlib.commands import Command, register_command, display_command, Option
......@@ -141,6 +142,11 @@ format_registry.register("subversion-wc", format.SvnWorkingTreeDirFormat,
native=False, hidden=True)
SPEC_TYPES.append(revspec.RevisionSpec_svn)
if getattr(log, "properties_handler_registry", None) is not None:
log.properties_handler_registry.register_lazy("subversion",
"bzrlib.plugins.svn.log",
"show_subversion_properties")
versions_checked = False
def lazy_check_versions():
"""Check whether all dependencies have the right versions.
......
# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from bzrlib.errors import InvalidRevisionId
from bzrlib.plugins.svn import mapping
def show_subversion_properties(rev):
data = None
ret = {}
if getattr(rev, "svn_revision", None) is not None:
data = (rev.svn_revision, rev.svn_branch)
else:
try:
(uuid, bp, revnum, mapp) = mapping.parse_revision_id(rev.revision_id)
except InvalidRevisionId:
pass
else:
data = (revnum, bp)
if data is not None:
return { "svn revno": "%d (on /%s)" % data}
return {}
......@@ -687,7 +687,7 @@ def parse_revision_id(revid):
"""Try to parse a Subversion revision id.
:param revid: Revision id to parse
:return: tuple with (uuid, branch_path, mapping)
:return: tuple with (uuid, branch_path, revno, mapping)
"""
if not revid.startswith("svn-"):
raise InvalidRevisionId(revid, None)
......
......@@ -524,10 +524,16 @@ class SvnRepository(Repository):
revmeta = RevisionMetadata(self, path, None, revnum, svn_revprops, svn_fileprops)
rev = Revision(revision_id=revision_id, parent_ids=revmeta.get_parent_ids(mapping),
rev = Revision(revision_id=revision_id,
parent_ids=revmeta.get_parent_ids(mapping),
inventory_sha1="")
mapping.import_revision(svn_revprops, svn_fileprops, self.uuid, path, revnum, rev)
rev.svn_revision = revnum
rev.svn_branch = path
rev.svn_uuid = self.uuid
mapping.import_revision(svn_revprops, svn_fileprops, self.uuid, path,
revnum, rev)
return rev
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment