This is an archive of the discontinued Mercurial Phabricator instance.

rebase: add a changes flag which will tell about the hash changes
AbandonedPublic

Authored by pulkit on Aug 26 2017, 7:52 AM.

Details

Reviewers
durin42
Group Reviewers
hg-reviewers
Summary

The --changes flag to rebase will tell user about the hash changes which
happened during the rebase once the rebase completes. The hash changes can also
be outputed as JSON by using --changes -q -Tjson. -q is required so that
things which are outputed by ui.status() are prevented and we get a JSON only
with the hash changes.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

pulkit created this revision.Aug 26 2017, 7:52 AM
pulkit edited the summary of this revision. (Show Details)Aug 26 2017, 7:55 AM
quark added a subscriber: quark.EditedAug 26 2017, 12:14 PM

I think a more general purposed approach is preferred here - see D173. If we make {changes} part of the template language (as suggested by the inline comment), the implementation of {changes} could be shared across multiple commands.

EDIT: the inline comment {changes|"..."} should be changed to {changes%"..."}.

hgext/rebase.py
487–488

I think automation may want full hash here. So we might want to allow that somehow.

Maybe we can use template to customize the output, like:

-T '{changes}' # default
-T '{changes|"{oldnode|short} -> {newnode|short}"}' # customized entry
-T '{changes|json}' # json formatted
In D525#8480, @quark wrote:

I think a more general purposed approach is preferred here - see D173. If we make {changes} part of the template language (as suggested by the inline comment), the implementation of {changes} could be shared across multiple commands.

I like the idea. I will try to send patches to use formatter there instead of using ui.status.

hgext/rebase.py
487–488

That looks like a nice idea, but since other outputs are repo.ui.* things and as far as I know, they can be templated, so we are only left with hash change output which we are adding.

durin42 requested changes to this revision.Aug 28 2017, 3:11 PM
durin42 added a subscriber: durin42.
durin42 added inline comments.
hgext/rebase.py
487–488

Definitely make these full hashes, and then have the default template for this output them as short hashes.

This revision now requires changes to proceed.Aug 28 2017, 3:11 PM
yuja added a subscriber: yuja.Aug 29 2017, 9:38 AM
yuja added inline comments.
hgext/rebase.py
487–488

fm.hexfunc can be used.

pulkit added inline comments.Aug 29 2017, 11:33 AM
hgext/rebase.py
487–488

Ah, revisiting this just realized my mistake. I wanted to say "repo.ui.* things can't be templated". Instead I said the opposite :(. @yuja Thanks for the suggestion.

pulkit edited edge metadata.Aug 29 2017, 12:06 PM
pulkit updated this revision to Diff 1406.
pulkit abandoned this revision.Aug 31 2017, 11:36 AM

Abandoning in favor of D581 and D582 which seems to be a more general approach.