~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Patch Queue Manager
  • Date: 2012-02-14 18:29:43 UTC
  • mfrom: (6404.6.11 cached-branch-store)
  • Revision ID: pqm@pqm.ubuntu.com-20120214182943-vso6j0mqdnxfkp7s
(vila) Cache the branch config store to avoid useless IOs. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005-2012 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
1205
1205
            # Remembers if asked explicitly or no previous location is set
1206
1206
            if (remember
1207
1207
                or (remember is None and branch_to.get_parent() is None)):
 
1208
                # FIXME: This shouldn't be done before the pull
 
1209
                # succeeds... -- vila 2012-01-02
1208
1210
                branch_to.set_parent(branch_from.base)
1209
1211
 
1210
1212
        if revision is not None:
3861
3863
            if directory is None:
3862
3864
                c = Branch.open_containing(u'.')[0].get_config_stack()
3863
3865
            else:
3864
 
                c = Branch.open(directory).get_config_stack()
 
3866
                b = Branch.open(directory)
 
3867
                self.add_cleanup(b.lock_write().unlock)
 
3868
                c = b.get_config_stack()
3865
3869
        else:
3866
3870
            c = _mod_config.GlobalStack()
3867
3871
        c.set('email', name)
5261
5265
            else:
5262
5266
                if location is None:
5263
5267
                    if b.get_bound_location() is not None:
5264
 
                        raise errors.BzrCommandError(gettext('Branch is already bound'))
 
5268
                        raise errors.BzrCommandError(
 
5269
                            gettext('Branch is already bound'))
5265
5270
                    else:
5266
 
                        raise errors.BzrCommandError(gettext('No location supplied '
5267
 
                            'and no previous location known'))
 
5271
                        raise errors.BzrCommandError(
 
5272
                            gettext('No location supplied'
 
5273
                                    ' and no previous location known'))
5268
5274
        b_other = Branch.open(location)
5269
5275
        try:
5270
5276
            b.bind(b_other)
5680
5686
        if public_branch is None:
5681
5687
            public_branch = stored_public_branch
5682
5688
        elif stored_public_branch is None:
 
5689
            # FIXME: Should be done only if we succeed ? -- vila 2012-01-03
5683
5690
            branch.set_public_branch(public_branch)
5684
5691
        if not include_bundle and public_branch is None:
5685
5692
            raise errors.BzrCommandError(gettext('No public branch specified or'