~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/bzrdir.py

  • Committer: Vincent Ladeuil
  • Date: 2011-11-24 15:48:29 UTC
  • mfrom: (6289 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6337.
  • Revision ID: v.ladeuil+lp@free.fr-20111124154829-avowjpsxdl8yp2vz
merge trunk resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from bzrlib.bzrdir import (
22
22
    BzrDir,
23
23
    BzrDirFormat,
24
 
    BzrDirMetaFormat1,
25
24
    BzrProber,
26
25
    )
27
26
from bzrlib.controldir import (
121
120
        return '/'.join(segments)
122
121
 
123
122
 
 
123
class SmartServerBzrDirRequestHasWorkingTree(SmartServerRequestBzrDir):
 
124
 
 
125
    def do_bzrdir_request(self, name=None):
 
126
        """Check whether there is a working tree present.
 
127
 
 
128
        New in 2.5.0.
 
129
 
 
130
        :return: If there is a working tree present, 'yes'.
 
131
            Otherwise 'no'.
 
132
        """
 
133
        if self._bzrdir.has_workingtree():
 
134
            return SuccessfulSmartServerResponse(('yes', ))
 
135
        else:
 
136
            return SuccessfulSmartServerResponse(('no', ))
 
137
 
 
138
 
 
139
class SmartServerBzrDirRequestDestroyRepository(SmartServerRequestBzrDir):
 
140
 
 
141
    def do_bzrdir_request(self, name=None):
 
142
        """Destroy the repository.
 
143
 
 
144
        New in 2.5.0.
 
145
 
 
146
        :return: On success, 'ok'.
 
147
        """
 
148
        try:
 
149
            self._bzrdir.destroy_repository()
 
150
        except errors.NoRepositoryPresent, e:
 
151
            return FailedSmartServerResponse(('norepository',))
 
152
        return SuccessfulSmartServerResponse(('ok',))
 
153
 
 
154
 
124
155
class SmartServerBzrDirRequestCloningMetaDir(SmartServerRequestBzrDir):
125
156
 
126
157
    def do_bzrdir_request(self, require_stacking):
150
181
        control_format = self._bzrdir.cloning_metadir(
151
182
            require_stacking=require_stacking)
152
183
        control_name = control_format.network_name()
153
 
        # XXX: There should be a method that tells us that the format does/does
154
 
        # not have subformats.
155
 
        if isinstance(control_format, BzrDirMetaFormat1):
 
184
        if not control_format.fixed_components:
156
185
            branch_name = ('branch',
157
186
                control_format.get_branch_format().network_name())
158
187
            repository_name = control_format.repository_format.network_name()