[PATCH 1 of 2] ui: add optional choices parameter to prompt()

Steve Borho steve at borho.org
Tue Apr 28 09:50:21 CDT 2009


On Tue, Apr 28, 2009 at 9:29 AM, Dirkjan Ochtman <dirkjan at ochtman.nl> wrote:
> On Tue, Apr 28, 2009 at 16:26, Greg Ward <greg-hg at gerg.ca> wrote:
>> (It might be nice to say what pat is supposed to be -- a regex object?
>>  A string containing a regex?  Something else?  (I haven't read the
>> code: should not be necessary to use the method!))
>
> Also, I've been wondering if pat could be obsoleted in favor of
> containment checking in choices. Or do we have actually
> complex/interesting regexes anywhere?

Good point.  I didn't find any places where a non trivial regexp pat
was specified.

def prompt(self, msg, choices=(), default='y'):

where choices is a list of pairs: ( ('c', 'Changed'), ('d', 'Deleted') )

--
Steve Borho



More information about the Mercurial-devel mailing list