This is an archive of the discontinued Mercurial Phabricator instance.

rebase: improve output of --dry-run
ClosedPublic

Authored by khanchi97 on Jun 17 2018, 7:48 AM.

Details

Summary

Improved output when in dryrun, for user to make sure that
no change will be written to repository.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

khanchi97 created this revision.Jun 17 2018, 7:48 AM
pulkit added a subscriber: pulkit.Jun 18 2018, 4:20 PM

Thinking out loud here: I see that --dry-run for rebase will be very useful for automation. How about returning 1 when there are conflicts and returning 0 when there are no conflicts? Also maybe we should add formatter support to the dry-run output for each command so that automation can read the JSON output and tell user what can happen.

In D3764#59425, @pulkit wrote:

Thinking out loud here: I see that --dry-run for rebase will be very useful for automation. How about returning 1 when there are conflicts and returning 0 when there are no conflicts? Also maybe we should add formatter support to the dry-run output for each command so that automation can read the JSON output and tell user what can happen.

I approve of both of these feature suggestions! However, they should be implemented in standalone changesets and not incorporated into this one.

okay @pulkit , let me confirm if IIUC your points.

  1. First thing is we would have a function which will accept a return_code(0 or 1) and output_data (what can happen without --dry-run) from any command (which has dry-run functionality). And will give output to the user according to the return_code. Following is the rough code for this, correct me if I am wrong at any point.
def dryrunformatter(retcode, **outputdata):
    ui.status(_("starting dry-run; repository will not be changed"))

    # here show the outputdata accordingly

    if retcode == 0:
        ui.status(_("dry-run completed successfully; run without --dry-run/-n to perform this action"))
    else:
        ui.status(_("hit conflicts!"))
  1. If above explanation is right, talking about "additional functionality in dryrun" like --verbose mode in rebase which @indygreg suggested. May be we can add this type of functionality too in dryrunformatter? What do you say?
khanchi97 edited the summary of this revision. (Show Details)Jun 22 2018, 10:13 AM
khanchi97 retitled this revision from rebase: improve output of --dry-run to rebase: no need to store backup during dry-run while aborting.
khanchi97 updated this revision to Diff 9258.

@khanchi97 you should have created a new differential so that we don't loose your earlier patch titled: 'rebase: improve output of --dry-run' which is yet under review.

In D3764#59425, @pulkit wrote:

Thinking out loud here: I see that --dry-run for rebase will be very useful for automation. How about returning 1 when there are conflicts and returning 0 when there are no conflicts? Also maybe we should add formatter support to the dry-run output for each command so that automation can read the JSON output and tell user what can happen.

I approve of both of these feature suggestions! However, they should be implemented in standalone changesets and not incorporated into this one.

I agree.

In D3764#59797, @pulkit wrote:

@khanchi97 you should have created a new differential so that we don't loose your earlier patch titled: 'rebase: improve output of --dry-run' which is yet under review.

Oh sorry, it was by mistake.

khanchi97 retitled this revision from rebase: no need to store backup during dry-run while aborting to rebase: improve output of --dry-run.Jun 22 2018, 12:02 PM
khanchi97 updated this revision to Diff 9259.
khanchi97 updated this revision to Diff 9263.Jun 23 2018, 8:48 AM
khanchi97 updated this revision to Diff 9264.Jun 23 2018, 8:53 AM
khanchi97 updated this revision to Diff 9268.Jun 24 2018, 6:18 AM
khanchi97 edited the summary of this revision. (Show Details)Jun 28 2018, 4:11 PM
khanchi97 updated this revision to Diff 9348.
khanchi97 updated this revision to Diff 9360.Jun 29 2018, 2:09 PM
pulkit accepted this revision.Jul 4 2018, 3:16 PM
This revision was automatically updated to reflect the committed changes.