[Bug 4261] New: Enforce No Named Branches
mercurial-bugs at selenic.com
mercurial-bugs at selenic.com
Tue May 27 19:03:53 CDT 2014
http://bz.selenic.com/show_bug.cgi?id=4261
Priority: normal
Bug ID: 4261
CC: mercurial-devel at selenic.com
Assignee: bugzilla at selenic.com
Summary: Enforce No Named Branches
Severity: feature
Classification: Unclassified
OS: Windows
Reporter: philip.w.mcadams at intel.com
Hardware: PC
Status: UNCONFIRMED
Version: 2.9.2
Component: Mercurial
Product: Mercurial
A customer is requesting to enforce no named branches on their repo.
Customer message is to:
this repo will need to enforce 'no named branches' and a precommit hook server
side would seem the way to do it, my understanding is this would most likely
need to be attached to the:
prechangegroup
hook
This could enforce that no named branches other than 'default' exist in the
push contents before accepting them.
If at all possible, a similar hook that I could instruct developers to use on
their clients to prevent 'commiting' such a changeset locally would be useful
as well.
In researching I found the following examples here:
http://mercurial.selenic.com/wiki/HookExamples
and am currently modifying the hook:
import re
def precommit_badbranch(ui, repo, **kwargs):
branch = repo[None].branch()
branch_re = re.compile(r'\d+\.\d+-branch$')
if not branch_re.match(branch):
ui.warn('invalid branch name %r (use <major>.<minor>-branch)\n')
return True
return False
My modified code is not working and wanted to inquire: Is it possible to
completely prevent the pushing branches the default? Could it simply be a
matter of modifications not working? I'm new to Python so wondering if thats
the issue of if there is no work around to only allowing default branch to be
pushed to.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Mercurial-devel
mailing list