Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/webcommands.py @ 8796:2bcef677a6c3
localrepo: remove 'closed' argument to heads(...) function
- repository heads are not associated with the closed attribute, so
remove it making the code in line with the concept.
- Fix functions that were calling heads with the parameter.
- Adjust webcommands.branches to include the concept of inactive
as well as open and closed branches
- Fix code and docstrings in commands to make the correct use of
closed branches & branch heads clearer
- Improve grammar of 'hg heads' help text (2nd submission)
this does not alter the cli for hg branches, that work is
still to be done
author | John Mulligan <phlogistonjohn@asynchrono.us> |
---|---|
date | Wed, 10 Jun 2009 19:11:49 -0400 |
parents | de6bb29e208a |
children | acd03a6e2426 |
comparison
equal
deleted
inserted
replaced
8795:51c29aec0b75 | 8796:2bcef677a6c3 |
---|---|
359 latestentry=lambda **x: entries(True,1, **x)) | 359 latestentry=lambda **x: entries(True,1, **x)) |
360 | 360 |
361 def branches(web, req, tmpl): | 361 def branches(web, req, tmpl): |
362 b = web.repo.branchtags() | 362 b = web.repo.branchtags() |
363 tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems()) | 363 tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems()) |
364 open = set(web.repo[n].branch() for n in web.repo.heads(closed=False)) | 364 heads = web.repo.heads() |
365 parity = paritygen(web.stripecount) | 365 parity = paritygen(web.stripecount) |
366 sortkey = lambda ctx: ('close' not in ctx.extra(), ctx.rev()) | 366 sortkey = lambda ctx: ('close' not in ctx.extra(), ctx.rev()) |
367 | 367 |
368 def entries(limit, **map): | 368 def entries(limit, **map): |
369 count = 0 | 369 count = 0 |
370 for ctx in sorted(tips, key=sortkey, reverse=True): | 370 for ctx in sorted(tips, key=sortkey, reverse=True): |
371 if limit > 0 and count >= limit: | 371 if limit > 0 and count >= limit: |
372 return | 372 return |
373 count += 1 | 373 count += 1 |
374 status = ctx.branch() in open and 'open' or 'closed' | 374 if ctx.node() not in heads: |
375 status = 'inactive' | |
376 elif not web.repo.branchheads(ctx.branch()): | |
377 status = 'closed' | |
378 else: | |
379 status = 'open' | |
375 yield {'parity': parity.next(), | 380 yield {'parity': parity.next(), |
376 'branch': ctx.branch(), | 381 'branch': ctx.branch(), |
377 'status': status, | 382 'status': status, |
378 'node': ctx.hex(), | 383 'node': ctx.hex(), |
379 'date': ctx.date()} | 384 'date': ctx.date()} |