[bug 93853][merge] Better message about inability to place tags in empty branch
John Arbash Meinel
john at arbash-meinel.com
Mon Jul 30 21:59:10 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> I intend to fix this properly, but would like to merge Tim's patch
> below as a stopgap. In merging it I'd add a comment with the bug
> number.
>
> ---------- Forwarded message ----------
> From: Tim Hatch <tim at timhatch.com>
> Date: Jul 27, 2007 5:28 PM
> Subject: [Bug 93853] Re: Tag command breaks badly with empty repository
> To: mbp at sourcefrog.net
>
>
> I also agree with John, having just hit this. Something along the lines
> of:
>
> === modified file 'bzrlib/builtins.py'
> --- bzrlib/builtins.py 2007-07-23 19:37:15 +0000
> +++ bzrlib/builtins.py 2007-07-27 22:24:01 +0000
> @@ -3847,6 +3847,10 @@
> revision_id = revision[0].in_history(branch).rev_id
> else:
> revision_id = branch.last_revision()
> + if not revision_id:
> + raise errors.BzrCommandError(
> + "Tags can not be placed on an empty branch, "
> + "try making a commit first")
> if (not force) and branch.tags.has_tag(tag_name):
> raise errors.TagAlreadyExists(tag_name)
> branch.tags.set_tag(tag_name, revision_id)
>
> --
> Tag command breaks badly with empty repository
> https://bugs.launchpad.net/bugs/93853
> You received this bug notification because you are a member of Bazaar
> Developers, which is the registrant for Bazaar.
I think [merge] has to be the first entry, not the second.
I think we would want to do:
revision_id = ensure_null(revision_id)
if revision_id != _mod_revision.NULL_REVISION:
raise errors.***
That way, when we upgrade branch.last_revision() to return NULL_REVISION, it
still works.
Also, this shouldn't be too hard to add as a blackbox test:
format = bzrlib.bzrdir.format_registry.get('dirstate-tags')
tree = self.make_branch_and_tree('.', format=format)
self.run_bzr_error(['Tags can not be placed on an empty branch'],
'tag')
Arguably we should check if the default format supports tags, and only if it
doesn't should we force 'dirstate-tags' format.
Otherwise, !approve
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGrlEeJdeBCYSNAAMRAh5iAKClsVGmkbCG4R2nbxgcn9J7XhDaNQCeMqHI
1hAG71mZNdQn12EcsLMleWs=
=WCTx
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list