[MERGE] Make accessing a branch.tags.get_tag_dict use a smart[er] method rather than VFS calls and real objects.
Andrew Bennetts
andrew.bennetts at canonical.com
Fri Mar 6 04:22:20 GMT 2009
Robert Collins wrote:
> This eliminates the last VFS call during 'bzr branch bzr+ssh://foo bar'
> where the source is not stacked.
bb:tweak
Overall this was a really nice patch, btw. I feel it leaves things cleaner than
it found them, which is always nice :)
[...]
> + def _set_tags_bytes(self, bytes):
> + """Mirror method for _get_tags_bytes.
> +
> + :seealso: Branch._get_tags_bytes.
> + """
> + self.lock_write()
> + try:
> + self._transport.put_bytes('tags', bytes)
> + finally:
> + self.unlock()
It's a touch ugly, but please use _run_with_write_locked_target (also defined in
branch.py) to avoid self.unlock() potentially obscuring an error during
put_bytes.
> === modified file 'bzrlib/smart/bzrdir.py'
[...]
> +class SmartServerRequestOpenBranchV2(SmartServerRequestBzrDir):
> +
> + def do_bzrdir_request(self):
> + """open a branch at path and return the reference or format."""
> + try:
> + reference_url = self._bzrdir.get_branch_reference()
> + if reference_url is None:
> + format = self._bzrdir.open_branch()._format.network_name()
> + return SuccessfulSmartServerResponse(('branch', format))
> + else:
> + return SuccessfulSmartServerResponse(('ref', reference_url))
> + except errors.NotBranchError:
> + return FailedSmartServerResponse(('nobranch', ))
I changed the cloning_metadir RPC similarly, but used "direct" and "reference"
rather than "branch" and "ref". We probably should be consistent... would you
mind updating my change to cloning_metadir to use "branch" and "ref" like yours
does? IIRC the test and code fallout should be pretty modest.
More information about the bazaar
mailing list