Closed Bug 450741 Opened 16 years ago Closed 16 years ago

need a way to allow a single head per branch on an hg repo

Categories

(Developer Services :: Mercurial: hg.mozilla.org, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bhearsum, Assigned: bhearsum)

References

Details

(Whiteboard: [hg-automation])

Attachments

(1 file, 2 obsolete files)

Attached patch allow single head per branch (obsolete) — Splinter Review
Since we're going with permanent named branches in our existing repositories this hook needs to be updated.

I've tested this patch locally and it seems to work as intended...note that we only test active branches. Inactive branches seem to list two heads with 'hg heads -r $branch' when we have more than one active branch...
Attachment #333924 - Flags: review?(benjamin)
Whiteboard: [hg-automation]
Comment on attachment 333924 [details] [diff] [review]
allow single head per branch

I think there's got to be a better way to do this as a python hook instead of a shell hook, but I'm going to ask djc for review in either case.
Attachment #333924 - Flags: review?(benjamin) → review?(dirkjan)
For the shell version, you should probably use hg branches -aq (-q is a global option only listed with hg help -v branches) rather than the awk construction (I think hg branch names can contain spaces), but I agree with bsmedberg that using a Python hook might be better.
Attached file python hook for single-head-per-branch (obsolete) —
It seems that branchheads() only returns one head for inactive branches. As I found out, 'hg heads -r $branch' and 'hg heads $branch' do different things. I bet I probably shouldn't have used '-r' in the shell version.

In any case, how does this look?
Attachment #333924 - Attachment is obsolete: true
Attachment #333933 - Flags: review?(dirkjan)
Attachment #333924 - Flags: review?(dirkjan)
Yes, after some testing, that seems fine. You may want to break after setting err = True, since the rest of the loop is useless anyway. Similarly, you could simplify to just one error message (set err = '' at the start, then err = branchname when it has multiple heads), which might be better. Otherwise, seems nice!
Or should I say r+djc? ;)
Attachment #333933 - Attachment is obsolete: true
Attachment #333933 - Flags: review?(dirkjan)
Comment on attachment 333959 [details] [diff] [review]
[checked in] address djc's comments, change example hgrc

Dunno who should review this. Benjamin? djc?
Attachment #333959 - Flags: review? → review?(dirkjan)
Attachment #333959 - Flags: review+
Summary: change hg_require_single_head to allow a single head per branch → need a way to allow a single head per branch on an hg repo
Comment on attachment 333959 [details] [diff] [review]
[checked in] address djc's comments, change example hgrc

changeset:   9:d1ffa7f6da59
Attachment #333959 - Attachment description: address djc's comments, change example hgrc → [checked in] address djc's comments, change example hgrc
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
I'm planning to do a named branch for 3.1a2. I filed bug 452431 to get this deployed on m-c, comm-central, and the l10n repositories.
Attachment #333959 - Flags: review?(dirkjan) → review+
Product: mozilla.org → Release Engineering
Product: Release Engineering → Developer Services
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: