This is an archive of the discontinued Mercurial Phabricator instance.

rebase: add an experimental.showhashchanges config to show hash changes
AbandonedPublic

Authored by pulkit on Oct 4 2017, 10:34 AM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Summary

This patch adds an experimental config, which if turned on will show hash
changes after a rebase. Support will be added to more commands which changes
hash.

This patch also adds test demonstrating the hash change output.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

pulkit created this revision.Oct 4 2017, 10:34 AM
pulkit updated this revision to Diff 2419.Oct 4 2017, 11:13 AM

I see what it does, but why? What's the motivation for the feature?

dlax added a subscriber: dlax.Oct 5 2017, 11:34 AM
pulkit added a comment.Oct 5 2017, 1:23 PM
In D934#15939, @durin42 wrote:

I see what it does, but why? What's the motivation for the feature?

It's for automation and helping editors such as Nuclide.

In D934#15995, @pulkit wrote:
In D934#15939, @durin42 wrote:

I see what it does, but why? What's the motivation for the feature?

It's for automation and helping editors such as Nuclide.

Could you please put that in the commit message?

I wonder if we could make this stuff that was just --verbose output for rebase, and always put it in the json output (-Tjson) via the formatter, and not require a config. What do you think of taht approach?

quark added a subscriber: quark.Oct 5 2017, 2:34 PM

I'm trying to write a version that decouples the rendering logic from the data. But it's trickier than I thought (ex. issue5699). I guess some refactoring needs to be done. Meanwhile I think it would be good enough if you can avoid passing fm around.

hgext/rebase.py
556

I think it's unnecessary to have a config option - there is no behavior change if users use rebase as before.

560

Instead of passing fm around, it would be cleaner if the content could be generated, like:

# "fm" is not passed elsewhere
with ui.formatter('rebase', opts) as fm:
    fm.startitem()
    fm.data(nodechanges=calculatenodechanges(mapping))

(node seems to be more consistent with existing terms than hash)

But this might be difficult without the args templatekeywords context.

tests/test-rebase-base.t
418

The -base.t test was intended for testing --base flag. We probably want a new .t file like test-rebase-templates.t.

462

For JSON output, it's usually for automation and better to use full hashes.

pulkit planned changes to this revision.Oct 6 2017, 5:15 PM
In D934#15996, @durin42 wrote:
In D934#15995, @pulkit wrote:
In D934#15939, @durin42 wrote:

I see what it does, but why? What's the motivation for the feature?

It's for automation and helping editors such as Nuclide.

Could you please put that in the commit message?
I wonder if we could make this stuff that was just --verbose output for rebase, and always put it in the json output (-Tjson) via the formatter, and not require a config. What do you think of taht approach?

I like the approach but I have followed Jun's one as that was easy and no UI change. :)

pulkit abandoned this revision.Oct 17 2017, 7:14 PM

Abandoning in favor of D1173.