Mercurial > hg
view mercurial/strutil.py @ 8695:9a89253a32e6
heads: show closed heads only when --closed is passed
Add a --closed (-c) option to 'hg heads' to show all heads and change the
default behavior to refrain from showing fully closed branches.
Enhance 'hg heads <branch>' so that:
* default: displays normal & inactive heads, not closed heads
* --closed: displays normal, inactive & closed heads
* --active: displays only normal heads
* both --closed and --active: displays normal & closed heads only
author | John Mulligan <phlogistonjohn@asynchrono.us> |
---|---|
date | Wed, 03 Jun 2009 13:59:38 +0200 |
parents | 46293a0c7e9f |
children | 25e572394f5c |
line wrap: on
line source
# strutil.py - string utilities for Mercurial # # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2, incorporated herein by reference. def findall(haystack, needle, start=0, end=None): if end is None: end = len(haystack) if end < 0: end += len(haystack) if start < 0: start += len(haystack) while start < end: c = haystack.find(needle, start, end) if c == -1: break yield c start = c + 1 def rfindall(haystack, needle, start=0, end=None): if end is None: end = len(haystack) if end < 0: end += len(haystack) if start < 0: start += len(haystack) while end >= 0: c = haystack.rfind(needle, start, end) if c == -1: break yield c end = c - 1