/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/smart/bzrdir.py

MergeĀ upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Server-side bzrdir related request implmentations."""
18
18
 
92
92
class SmartServerBzrDirRequestCloningMetaDir(SmartServerRequestBzrDir):
93
93
 
94
94
    def do_bzrdir_request(self, require_stacking):
95
 
        """Get the format that should be used when cloning from this dir."""
 
95
        """Get the format that should be used when cloning from this dir.
 
96
 
 
97
        New in 1.13.
 
98
        
 
99
        :return: on success, a 3-tuple of network names for (control,
 
100
            repository, branch) directories, where '' signifies "not present".
 
101
            If this BzrDir contains a branch reference then this will fail with
 
102
            BranchReference; clients should resolve branch references before
 
103
            calling this RPC.
 
104
        """
96
105
        try:
97
106
            branch_ref = self._bzrdir.get_branch_reference()
98
107
        except errors.NotBranchError:
99
108
            branch_ref = None
 
109
        if branch_ref is not None:
 
110
            # The server shouldn't try to resolve references, and it quite
 
111
            # possibly can't reach them anyway.  The client needs to resolve
 
112
            # the branch reference to determine the cloning_metadir.
 
113
            return FailedSmartServerResponse(('BranchReference',))
100
114
        if require_stacking == "True":
101
115
            require_stacking = True
102
116
        else:
104
118
        control_format = self._bzrdir.cloning_metadir(
105
119
            require_stacking=require_stacking)
106
120
        control_name = control_format.network_name()
107
 
        # XXX: There should be a method that tells us that the format does/does not
108
 
        # have subformats.
 
121
        # XXX: There should be a method that tells us that the format does/does
 
122
        # not have subformats.
109
123
        if isinstance(control_format, BzrDirMetaFormat1):
110
 
            if branch_ref is not None:
111
 
                # If there's a branch reference, the client will have to resolve
112
 
                # the branch reference to figure out the cloning metadir
113
 
                branch_name = ('ref', branch_ref)
114
 
            else:
115
 
                branch_name = ('branch',
116
 
                    control_format.get_branch_format().network_name())
 
124
            branch_name = ('branch',
 
125
                control_format.get_branch_format().network_name())
117
126
            repository_name = control_format.repository_format.network_name()
118
127
        else:
119
128
            # Only MetaDir has delegated formats today.
322
331
        try:
323
332
            reference_url = self._bzrdir.get_branch_reference()
324
333
            if reference_url is None:
325
 
                format = self._bzrdir.open_branch()._format.network_name()
 
334
                br = self._bzrdir.open_branch(ignore_fallbacks=True)
 
335
                format = br._format.network_name()
326
336
                return SuccessfulSmartServerResponse(('branch', format))
327
337
            else:
328
338
                return SuccessfulSmartServerResponse(('ref', reference_url))