Mercurial > public > mercurial-scm > hg
diff hgext/absorb.py @ 40190:31dfa7dac4c9
absorb: prompt user to accept absorb changes by default
Change the default absorb behaviour to print the changes out and then prompt
the user if they want to absorb the changes or not.
Providing the `-p` option still prints the result and exits. A new `-a` option
is provided which applies the changes without printing them, giving the
equivalent of the old behaviour.
Differential Revision: https://phab.mercurial-scm.org/D4999
author | Mark Thomas <mbthomas@fb.com> |
---|---|
date | Fri, 12 Oct 2018 17:48:40 +0000 |
parents | 2c5316796f45 |
children | 8f192f2c4a1e |
line wrap: on
line diff
--- a/hgext/absorb.py Fri Oct 12 15:46:52 2018 +0000 +++ b/hgext/absorb.py Fri Oct 12 17:48:40 2018 +0000 @@ -952,7 +952,7 @@ chunks = cmdutil.recordfilter(ui, origchunks)[0] targetctx = overlaydiffcontext(stack[-1], chunks) fm = None - if opts.get('print_changes'): + if opts.get('print_changes') or not opts.get('apply_changes'): fm = ui.formatter('absorb', opts) state.diffwith(targetctx, matcher, fm) if fm is not None: @@ -971,6 +971,10 @@ label='absorb.description') fm.end() if not opts.get('dry_run'): + if not opts.get('apply_changes'): + if ui.promptchoice("apply changes (yn)? $$ &Yes $$ &No", default=1): + raise error.Abort(_('absorb cancelled\n')) + state.apply() if state.commit(): state.printchunkstats() @@ -979,8 +983,10 @@ return state @command('^absorb', - [('p', 'print-changes', None, - _('print which changesets are modified by which changes')), + [('a', 'apply-changes', None, + _('apply changes without prompting for confirmation')), + ('p', 'print-changes', None, + _('just print which changesets are modified by which changes')), ('i', 'interactive', None, _('interactively select which chunks to apply (EXPERIMENTAL)')), ('e', 'edit-lines', None,