~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/branch.py

  • Committer: John Arbash Meinel
  • Date: 2010-01-13 16:23:07 UTC
  • mto: (4634.119.7 2.0)
  • mto: This revision was merged to the branch mainline in revision 4959.
  • Revision ID: john@arbash-meinel.com-20100113162307-0bs82td16gzih827
Update the MANIFEST.in file.

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
 
106
142
class SmartServerBranchRequestGetStackedOnURL(SmartServerBranchRequest):
107
143
 
108
144
    def do_with_branch(self, branch):