Call for discussion: Phase names

John Coomes John.Coomes at oracle.com
Wed Jan 11 20:32:37 CST 2012


Olav Reinert (seroton10 at gmail.com) wrote:
> Now that the discussion has quietened down a bit, I would like to bring a thought or two to the table:
> 
> 
> On 9. jan 2012, at 20.28, Olav Reinert wrote:
> 
> > To summarize: The three phase names must have unique initial letters, and should preferably be short. Because we intend to use those initial letters as single-letter option names, they should not clash with other common options, such as -f (for --force); hence, phase names like "final" will face resistance.
> 
> On Tue, 3 Jan 2012 13:05:57 +0100, Jason Harris wrote (in another thread):
> 
> > The other things which strikes me is that our english names which are longer and
> > more readable should really be the thing which documents our interface here. The
> > cryptic one letter abbreviation is very nice to have match the first letter of
> > our chosen name, but messing up our naming scheme hence our mental map of what
> > does what just to ensure that the first letter matches is IMHO wrong. The full
> > english names should be clear cut and intelligible and self-documenting.
> > 
> > Besides, we already break this first-letter-is-shortcut rule in at least several
> > places eg hg diff where we have -a for --text, -p for --show-function, -w for
> > --ignore-all-space, -b, -B etc; or in hg import -p for --strip. Or the verbose
> > option -y for --noninteractive. etc.
> 
> 
> Given the background above, and the fact that the search for these phase names has been rather agonizing, I started considering the following:
> 
> As far as I have understood it, the point of introducing phases is primarily to enable Mercurial to determine when a history rewrite operation is safe. Thus, the most important change in the behavior of Mercurial, from a user's point of view, is that it sometimes makes smarter choices, or gives better warnings/errors.
> 
> Because history already passed on to other clones is the reason why history rewrites may be unsafe, phases also includes mechanisms for preventing (or at least warning about) premature sharing of history. I also assume that Mercurial will manage most phase transitions automatically, using sensible defaults. That is, the majority of the common Mercurial use cases do not require explicit phase manipulations at all.
> 
> If the above is true, it seems to me that the rule about unique initial letters for phase names, and requiring the ability to specify a phase using only a single-letter option (instead of writing something like "-p draft") is way too much to ask for. To me it is almost as absurd as forbidding options starting with [0-9a-f] because we refuse to prefix hex revision numbers with "-r".
> 
> If my assumptions above are true, and if the need to specify a phase name is actually a fairly rare use case, shouldn't we just drop those rules about the initial letter of phase names, and instead make peace with "-p <phase>"?
> 
> Because then we could use public/draft/private as phase names. It seems to me that most people are OK with those names.
> 
> Just a though...

+1.  I couldn't find a good set of names that meet the
non-clashing-initial-letter criterion, even with a thesaurus.  I'd be
happy enough with -p <phase> or --<phase> (e.g., --public, --draft,
--private, which can be shortened to --pub, --pri, etc.).

-John


More information about the Mercurial-devel mailing list