Rev 99: Merge foreign branch utility code. in http://people.samba.org/bzr/jelmer/bzr-git/trunk

Jelmer Vernooij jelmer at samba.org
Wed Aug 27 20:39:51 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-git/trunk

------------------------------------------------------------
revno: 99
revision-id: jelmer at samba.org-20080827193949-h83vvuh1m3b8oazp
parent: jelmer at samba.org-20080823174607-ykdz37b3ike35cvk
parent: jelmer at samba.org-20080827193631-0q15lou3t0eb06sx
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Wed 2008-08-27 21:39:49 +0200
message:
  Merge foreign branch utility code.
added:
  foreign/                       tree_root-20080827193244-xcm0lj66wynltm4e-1
  foreign/__init__.py            foreign.py-20080827193306-rxeku2c2obec90c4-1
    ------------------------------------------------------------
    revno: 0.1.2
    revision-id: jelmer at samba.org-20080827193631-0q15lou3t0eb06sx
    parent: jelmer at samba.org-20080827193429-fnjlgo2m7mmy2py6
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Wed 2008-08-27 21:36:31 +0200
    message:
      Rename to __init__.py.
    renamed:
      foreign.py => __init__.py foreign.py-20080827193306-rxeku2c2obec90c4-1
    ------------------------------------------------------------
    revno: 0.1.1
    revision-id: jelmer at samba.org-20080827193429-fnjlgo2m7mmy2py6
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Wed 2008-08-27 21:34:29 +0200
    message:
      Import utility functions for foreign branches.
    added:
      foreign.py                     foreign.py-20080827193306-rxeku2c2obec90c4-1
=== added directory 'foreign'
=== added file 'foreign/__init__.py'
--- a/foreign/__init__.py	1970-01-01 00:00:00 +0000
+++ b/foreign/__init__.py	2008-08-27 19:36:31 +0000
@@ -0,0 +1,52 @@
+# Copyright (C) 2008 Jelmer Vernooij <jelmer at 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 2 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, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+"""Foreign branch utilities."""
+
+class VcsMapping(object):
+    """Describes the mapping between the semantics of Bazaar and a foreign vcs.
+
+    """
+    experimental = False
+    roundtripping = False
+    revid_prefix = None
+
+
+class VcsMappingRegistry(registry.Registry):
+    """Registry for Bazaar<->foreign VCS mappings.
+    
+    There should be one instance of this registry for every foreign VCS.
+    """
+
+    def register(self, key, factory, help):
+        """Register a mapping between Bazaar and foreign VCS semantics.
+
+        The factory must be a callable that takes one parameter: the key.
+        It must produce an instance of VcsMapping when called.
+        """
+        registry.Registry.register(self, key, factory, help)
+
+    def set_default(self, key):
+        """Set the 'default' key to be a clone of the supplied key.
+
+        This method must be called once and only once.
+        """
+        self._set_default_key(key)
+
+    def get_default(self):
+        """Convenience function for obtaining the default mapping to use."""
+        return self.get(self._get_default_key())
+




More information about the bazaar-commits mailing list