~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/branch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-04-09 20:23:07 UTC
  • mfrom: (4265.1.4 bbc-merge)
  • Revision ID: pqm@pqm.ubuntu.com-20090409202307-n0depb16qepoe21o
(jam) Change _fetch_uses_deltas = False for CHK repos until we can
        write a better fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
        return SuccessfulSmartServerResponse((bytes,))
104
104
 
105
105
 
106
 
class SmartServerBranchSetTagsBytes(SmartServerLockedBranchRequest):
107
 
 
108
 
    def __init__(self, backing_transport, root_client_path='/'):
109
 
        SmartServerLockedBranchRequest.__init__(
110
 
            self, backing_transport, root_client_path)
111
 
        self.locked = False
112
 
        
113
 
    def do_with_locked_branch(self, branch):
114
 
        """Call _set_tags_bytes for a branch.
115
 
 
116
 
        New in 1.18.
117
 
        """
118
 
        # We need to keep this branch locked until we get a body with the tags
119
 
        # bytes.
120
 
        self.branch = branch
121
 
        self.branch.lock_write()
122
 
        self.locked = True
123
 
 
124
 
    def do_body(self, bytes):
125
 
        self.branch._set_tags_bytes(bytes)
126
 
        return SuccessfulSmartServerResponse(())
127
 
 
128
 
    def do_end(self):
129
 
        # TODO: this request shouldn't have to do this housekeeping manually.
130
 
        # Some of this logic probably belongs in a base class.
131
 
        if not self.locked:
132
 
            # We never acquired the branch successfully in the first place, so
133
 
            # there's nothing more to do.
134
 
            return
135
 
        try:
136
 
            return SmartServerLockedBranchRequest.do_end(self)
137
 
        finally:
138
 
            # Only try unlocking if we locked successfully in the first place
139
 
            self.branch.unlock()
140
 
 
141
 
 
142
106
class SmartServerBranchRequestGetStackedOnURL(SmartServerBranchRequest):
143
107
 
144
108
    def do_with_branch(self, branch):
273
237
        return SuccessfulSmartServerResponse(('ok',))
274
238
 
275
239
 
276
 
class SmartServerBranchRequestSetParentLocation(SmartServerLockedBranchRequest):
277
 
    """Set the parent location for a branch.
278
 
    
279
 
    Takes a location to set, which must be utf8 encoded.
280
 
    """
281
 
 
282
 
    def do_with_locked_branch(self, branch, location):
283
 
        branch._set_parent_location(location)
284
 
        return SuccessfulSmartServerResponse(())
285
 
 
286
 
 
287
240
class SmartServerBranchRequestLockWrite(SmartServerBranchRequest):
288
241
 
289
242
    def do_with_branch(self, branch, branch_token='', repo_token=''):