Rev 3966: (Jelmer) Move ForeignVcsMapping.show_foreign_revid to ForeignVcs. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Jan 28 10:54:54 GMT 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3966
revision-id: pqm at pqm.ubuntu.com-20090128105451-ih99x6vzhtmfysjf
parent: pqm at pqm.ubuntu.com-20090128094113-ze5jnburw91g2e4n
parent: jelmer at samba.org-20090128093139-j005iw0qi00110dz
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-01-28 10:54:51 +0000
message:
(Jelmer) Move ForeignVcsMapping.show_foreign_revid to ForeignVcs.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/foreign.py foreign.py-20081112170002-olsxmandkk8qyfuq-1
bzrlib/tests/test_foreign.py test_foreign.py-20081125004048-ywb901edgp9lluxo-1
------------------------------------------------------------
revno: 3949.5.2
revision-id: jelmer at samba.org-20090128093139-j005iw0qi00110dz
parent: jelmer at samba.org-20090122143640-ymqoypm29mcmi4ku
parent: pqm at pqm.ubuntu.com-20090126181248-yl5ctbxc3y6nu9m4
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: foreign-revid-show
timestamp: Wed 2009-01-28 10:31:39 +0100
message:
Merge bzr.dev
added:
bzrlib/tests/branch_implementations/test_dotted_revno_to_revision_id.py test_dotted_revno_to-20090121014844-6x7d9jtri5sspg1o-1
bzrlib/tests/branch_implementations/test_iter_merge_sorted_revisions.py test_merge_sorted_re-20090121004847-to3gvjwigstu93eh-1
bzrlib/tests/branch_implementations/test_revision_id_to_dotted_revno.py test_revision_id_to_-20090122052032-g3czslif6sdqfkh3-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/progress.py progress.py-20050610070202-df9faaab791964c0
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/revisionspec.py revisionspec.py-20050907152633-17567659fd5c0ddb
bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
bzrlib/tests/test_knit.py test_knit.py-20051212171302-95d4c00dd5f11f2b
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
bzrlib/tests/test_merge.py testmerge.py-20050905070950-c1b5aa49ff911024
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
bzrlib/tests/test_progress.py test_progress.py-20060308160359-978c397bc79b7fda
bzrlib/tests/test_ui.py test_ui.py-20051130162854-458e667a7414af09
bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
bzrlib/transport/http/_urllib.py _urlgrabber.py-20060113083826-0bbf7d992fbf090c
bzrlib/transport/http/response.py _response.py-20060613154423-a2ci7hd4iw5c7fnt-1
bzrlib/ui/__init__.py ui.py-20050824083933-8cf663c763ba53a9
bzrlib/ui/text.py text.py-20051130153916-2e438cffc8afc478
doc/developers/api-versioning.txt apiversioning.txt-20070626065626-iiihgmhgkv91uphz-1
doc/developers/plugin-api.txt pluginapi.txt-20080229110225-q2j5y4agqhlkjn0s-1
------------------------------------------------------------
revno: 3949.5.1
revision-id: jelmer at samba.org-20090122143640-ymqoypm29mcmi4ku
parent: pqm at pqm.ubuntu.com-20090120210300-641tutf1rkdn8a3n
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: foreign-revid-show
timestamp: Thu 2009-01-22 15:36:40 +0100
message:
Move ForeignVcsMapping.show_foreign_revid to ForeignVcs.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/foreign.py foreign.py-20081112170002-olsxmandkk8qyfuq-1
bzrlib/tests/test_foreign.py test_foreign.py-20081125004048-ywb901edgp9lluxo-1
=== modified file 'NEWS'
--- a/NEWS 2009-01-27 23:06:35 +0000
+++ b/NEWS 2009-01-28 10:54:51 +0000
@@ -86,6 +86,12 @@
* ``ProgressBarStack`` is deprecated; instead use
``ui_factory.nested_progress_bar`` to create new progress bars.
+ * ForeignVcsMapping() now requires a ForeignVcs object as first
+ argument. (Jelmer Vernooij)
+
+ * ForeignVcsMapping.show_foreign_revid() has been moved to
+ ForeignVcs. (Jelmer Vernooij)
+
* The progress and UI classes have changed; the main APIs remain the
same but code that provides a new UI or progress bar class may
need to be updated. (Martin Pool)
=== modified file 'bzrlib/foreign.py'
--- a/bzrlib/foreign.py 2008-12-24 04:26:08 +0000
+++ b/bzrlib/foreign.py 2009-01-22 14:36:40 +0000
@@ -45,6 +45,13 @@
# using this mapping.
revid_prefix = None
+ def __init__(self, vcs):
+ """Create a new VcsMapping.
+
+ :param vcs: VCS that this mapping maps to Bazaar
+ """
+ self.vcs = vcs
+
def revision_id_bzr_to_foreign(self, bzr_revid):
"""Parse a bzr revision id and convert it to a foreign revid.
@@ -61,15 +68,6 @@
"""
raise NotImplementedError(self.revision_id_foreign_to_bzr)
- def show_foreign_revid(self, foreign_revid):
- """Prepare a foreign revision id for formatting using bzr log.
-
- :param foreign_revid: Foreign revision id.
- :return: Dictionary mapping string keys to string values.
- """
- # TODO: This could be on ForeignVcs instead
- return { }
-
class VcsMappingRegistry(registry.Registry):
"""Registry for Bazaar<->foreign VCS mappings.
@@ -124,7 +122,7 @@
"""
# Revision comes directly from a foreign repository
if isinstance(rev, ForeignRevision):
- return rev.mapping.show_foreign_revid(rev.foreign_revid)
+ return rev.mapping.vcs.show_foreign_revid(rev.foreign_revid)
# Revision was once imported from a foreign repository
try:
@@ -133,7 +131,7 @@
except errors.InvalidRevisionId:
return {}
- return mapping.show_foreign_revid(foreign_revid)
+ return mapping.vcs.show_foreign_revid(foreign_revid)
class ForeignVcs(object):
@@ -142,6 +140,14 @@
def __init__(self, mapping_registry):
self.mapping_registry = mapping_registry
+ def show_foreign_revid(self, foreign_revid):
+ """Prepare a foreign revision id for formatting using bzr log.
+
+ :param foreign_revid: Foreign revision id.
+ :return: Dictionary mapping string keys to string values.
+ """
+ return { }
+
class ForeignVcsRegistry(registry.Registry):
"""Registry for Foreign VCSes.
=== modified file 'bzrlib/tests/test_foreign.py'
--- a/bzrlib/tests/test_foreign.py 2008-11-25 03:05:14 +0000
+++ b/bzrlib/tests/test_foreign.py 2009-01-22 14:36:40 +0000
@@ -28,9 +28,6 @@
def __eq__(self, other):
return type(self) == type(other)
- def show_foreign_revid(self, foreign_revid):
- return { "dummy ding": "%s/%s\\%s" % foreign_revid }
-
def revision_id_bzr_to_foreign(self, bzr_revid):
return tuple(bzr_revid[len("dummy-v1:"):].split("-")), self
@@ -56,9 +53,13 @@
def __init__(self):
self.mapping_registry = DummyForeignVcsMappingRegistry()
- self.mapping_registry.register("v1", DummyForeignVcsMapping(),
+ self.mapping_registry.register("v1", DummyForeignVcsMapping(self),
"Version 1")
+ def show_foreign_revid(self, foreign_revid):
+ return { "dummy ding": "%s/%s\\%s" % foreign_revid }
+
+
class ForeignVcsRegistryTests(TestCase):
@@ -74,8 +75,9 @@
def test_parse_revision_id(self):
reg = foreign.ForeignVcsRegistry()
- reg.register("dummy", DummyForeignVcs(), "Dummy VCS")
- self.assertEquals((("some", "foreign", "revid"), DummyForeignVcsMapping()),
+ vcs = DummyForeignVcs()
+ reg.register("dummy", vcs, "Dummy VCS")
+ self.assertEquals((("some", "foreign", "revid"), DummyForeignVcsMapping(vcs)),
reg.parse_revision_id("dummy-v1:some-foreign-revid"))
@@ -83,7 +85,7 @@
"""Tests for the ForeignRevision class."""
def test_create(self):
- mapp = DummyForeignVcsMapping()
+ mapp = DummyForeignVcsMapping(DummyForeignVcs())
rev = foreign.ForeignRevision(("a", "foreign", "revid"),
mapp, "roundtripped-revid")
self.assertEquals("", rev.inventory_sha1)
@@ -96,8 +98,9 @@
def setUp(self):
super(ShowForeignPropertiesTests, self).setUp()
+ self.vcs = DummyForeignVcs()
foreign.foreign_vcs_registry.register("dummy",
- DummyForeignVcs(), "Dummy VCS")
+ self.vcs, "Dummy VCS")
def tearDown(self):
super(ShowForeignPropertiesTests, self).tearDown()
@@ -114,7 +117,7 @@
def test_show_direct(self):
rev = foreign.ForeignRevision(("some", "foreign", "revid"),
- DummyForeignVcsMapping(),
+ DummyForeignVcsMapping(self.vcs),
"roundtrip-revid")
self.assertEquals({ "dummy ding": "some/foreign\\revid" },
foreign.show_foreign_properties(rev))
More information about the bazaar-commits
mailing list