/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: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from __future__ import absolute_import
20
20
 
21
 
from ... import (
 
21
from bzrlib import (
22
22
    bencode,
23
23
    errors,
24
24
    revision as _mod_revision,
25
25
    )
26
 
from ...controldir import ControlDir
27
 
from .request import (
 
26
from bzrlib.controldir import ControlDir
 
27
from bzrlib.smart.request import (
28
28
    FailedSmartServerResponse,
29
29
    SmartServerRequest,
30
30
    SuccessfulSmartServerResponse,
213
213
        The revision list is returned as the body content,
214
214
        with each revision utf8 encoded and \x00 joined.
215
215
        """
216
 
        with branch.lock_read():
 
216
        branch.lock_read()
 
217
        try:
217
218
            graph = branch.repository.get_graph()
218
219
            stop_revisions = (None, _mod_revision.NULL_REVISION)
219
220
            history = list(graph.iter_lefthand_ancestry(
220
221
                branch.last_revision(), stop_revisions))
 
222
        finally:
 
223
            branch.unlock()
221
224
        return SuccessfulSmartServerResponse(
222
225
            ('ok', ), ('\x00'.join(reversed(history))))
223
226
 
258
261
    def do_with_locked_branch(self, branch, *args):
259
262
        try:
260
263
            return self.do_tip_change_with_locked_branch(branch, *args)
261
 
        except errors.TipChangeRejected as e:
 
264
        except errors.TipChangeRejected, e:
262
265
            msg = e.msg
263
266
            if isinstance(msg, unicode):
264
267
                msg = msg.encode('utf-8')
357
360
    """Branch.set_last_revision_info.  Sets the revno and the revision ID of
358
361
    the specified branch.
359
362
 
360
 
    New in breezy 1.4.
 
363
    New in bzrlib 1.4.
361
364
    """
362
365
 
363
366
    def do_tip_change_with_locked_branch(self, branch, new_revno,
393
396
                token=repo_token).repository_token
394
397
            try:
395
398
                branch_token = branch.lock_write(
396
 
                    token=branch_token).token
 
399
                    token=branch_token).branch_token
397
400
            finally:
398
401
                # this leaves the repository with 1 lock
399
402
                branch.repository.unlock()
403
406
            return FailedSmartServerResponse(('TokenMismatch',))
404
407
        except errors.UnlockableTransport:
405
408
            return FailedSmartServerResponse(('UnlockableTransport',))
406
 
        except errors.LockFailed as e:
 
409
        except errors.LockFailed, e:
407
410
            return FailedSmartServerResponse(('LockFailed', str(e.lock), str(e.why)))
408
411
        if repo_token is None:
409
412
            repo_token = ''