Rev 2399: start adding ControlFiles base class in http://sourcefrog.net/bzr/no-controlfiles
Martin Pool
mbp at sourcefrog.net
Thu Apr 5 07:46:51 BST 2007
At http://sourcefrog.net/bzr/no-controlfiles
------------------------------------------------------------
revno: 2399
revision-id: mbp at sourcefrog.net-20070405064650-d7bdzbnzekz24bg5
parent: mbp at sourcefrog.net-20070405062529-h5e33vin342zj1de
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: no-controlfiles
timestamp: Thu 2007-04-05 16:46:50 +1000
message:
start adding ControlFiles base class
added:
bzrlib/control_files.py control_files.py-20070405064621-sgm3oud5ojtt351c-1
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
=== added file 'bzrlib/control_files.py'
--- a/bzrlib/control_files.py 1970-01-01 00:00:00 +0000
+++ b/bzrlib/control_files.py 2007-04-05 06:46:50 +0000
@@ -0,0 +1,36 @@
+# Copyright (C) 2005, 2006, 2007 Canonical Ltd
+#
+# 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
+
+"""Control files for a bzrdir, repository, branch or workingtree."""
+
+class ControlFiles(object):
+ """Base class for metadata control files.
+
+ This class has common behaviour for bzrdirs, repositories, branches
+ and workingtrees. Although they have different purposes and there
+ are different concrete implementations there are some things in
+ common:
+
+ * All use a Transport to access their metadata.
+ * All are protected by a Lock of some kind.
+ * All are identified by a format string or similar mechanism.
+
+ :ivar _transport: Transport pointing to the control directory:
+ for a BzrDir this is the '.bzr' directory;
+ for a Branch this is the '.bzr/branch' etc.
+
+ :ivar _lock: Object providing the lock protocol.
+ """
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2007-04-05 06:25:07 +0000
+++ b/bzrlib/branch.py 2007-04-05 06:46:50 +0000
@@ -28,6 +28,7 @@
bzrdir,
cache_utf8,
config as _mod_config,
+ control_files,
errors,
lockdir,
lockable_files,
@@ -80,7 +81,7 @@
######################################################################
# branch objects
-class Branch(object):
+class Branch(control_files.ControlFiles):
"""Branch holding a history of revisions.
base
More information about the bazaar-commits
mailing list