Any way to protect " tags" in bazaar?

Asked by Vijaya Kumar

Hi,

How to protect release tags in bazaar , i.e user should not able to delete the tags, only admin should do that ?

Regards,
VJ

Question information

Language:
English Edit question
Status:
Answered
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Martin Pool (mbp) said :
#1

On 12 January 2012 09:50, Vijaya Kumar
<email address hidden> wrote:
> New question #184462 on Bazaar:
> https://answers.launchpad.net/bzr/+question/184462
>
> Hi,
>
> How to protect release tags in bazaar  , i.e user should not able to delete the tags, only admin should do that ?

If the user can write to the repository, they can change any tags.
The simplest thing is probably just to tell your users: "don't change
release tags after they're made."

You could have a separate repository, writable only by release
managers, that contains the definitive tags.

You could do a patch to bzr that runs a hook before tag changes are
attempted, and then use that to enforce a policy about who can change
them. We can help you add the hook if you want to try this.

--
Martin

Revision history for this message
Vijaya Kumar (vijayakumar-cm) said :
#2

Hi Martin,

This hook method sounds good, could you please guide me to write a hook for this.

Thanks & Regards,
Vijay

Revision history for this message
Vijaya Kumar (vijayakumar-cm) said :
#3

could you help us in setting up hooks for protecting tag deletion.

Revision history for this message
Jelmer Vernooij (jelmer) said :
#4

You would probably want to add the hook in bzrlib/tag.py in the bzr source code, and tests to see that those hooks actually get run in bzrlib/tests/test_tag.py. There are several good examples of hooks in bzrlib/branch.py.

Revision history for this message
Vijaya Kumar (vijayakumar-cm) said :
#5

Could you please more specific..
1. copy the script tag.py from ../bzrlib/tag.py to source code repository ?

Repository contains, .bzr/branch
                                        .bzr/branch-lock
                                        .bzr/repository
Where to copy that script and how to test it?

Do I need to modify that tag.py to protect tag deletion?

Revision history for this message
Jelmer Vernooij (jelmer) said :
#6

On 01/18/2012 03:20 AM, Vijaya Kumar wrote:
> Question #184462 on Bazaar changed:
> https://answers.launchpad.net/bzr/+question/184462
>
> Status: Answered => Open
>
> Vijaya Kumar is still having a problem:
> Could you please more specific..
> 1. copy the script tag.py from ../bzrlib/tag.py to source code repository ?
>
> Repository contains, .bzr/branch
> .bzr/branch-lock
> .bzr/repository
> Where to copy that script and how to test it?
>
> Do I need to modify that tag.py to protect tag deletion?
No, there's no need need to copy anything.

You will need to edit the bzrlib/tag.py file from the bzr source
distribution to add support for hooks (it doesn't exist yet). This will
involve python programming.

Cheers,

Jelmer

Can you help with this problem?

Provide an answer of your own, or ask Vijaya Kumar for more information if necessary.

To post a message you must log in.