/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/branch.py

  • Committer: Andrew Bennetts
  • Date: 2009-07-22 10:55:35 UTC
  • mto: This revision was merged to the branch mainline in revision 4573.
  • Revision ID: andrew.bennetts@canonical.com-20090722105535-t2iv2j8zbj2230q2
Add Branch.set_tags_bytes RPC, with HPSS call count acceptance test.  Also fixes serialisation of LockDir, and uses external_url() in LockDir's repr and contention message.

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
 
106
106
class SmartServerBranchSetTagsBytes(SmartServerLockedBranchRequest):
107
107
 
108
 
    def __init__(self, backing_transport, root_client_path='/', jail_root=None):
109
 
        SmartServerLockedBranchRequest.__init__(
110
 
            self, backing_transport, root_client_path, jail_root)
111
 
        self.locked = False
112
 
        
113
108
    def do_with_locked_branch(self, branch):
114
 
        """Call _set_tags_bytes for a branch.
115
 
 
116
 
        New in 1.18.
117
 
        """
118
109
        # We need to keep this branch locked until we get a body with the tags
119
110
        # bytes.
120
111
        self.branch = branch
121
112
        self.branch.lock_write()
122
 
        self.locked = True
123
113
 
124
114
    def do_body(self, bytes):
125
115
        self.branch._set_tags_bytes(bytes)
126
116
        return SuccessfulSmartServerResponse(())
127
117
 
128
118
    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
119
        try:
136
120
            return SmartServerLockedBranchRequest.do_end(self)
137
121
        finally:
138
 
            # Only try unlocking if we locked successfully in the first place
 
122
            # XXX: should only try unlock if we locked successfully!
139
123
            self.branch.unlock()
140
124
 
141
125