Issue #1682 open

Rejection by remote hook is not reported as error

Anonymous created an issue

When pushing to remote https repository and commit is blocked by remote hook it is not reported as error. Status message (above history window) is green “Push to https://... aborted, ret 1”. It should be red (error) because push failed.

Tested on remote hook: {{{

!python

def pretxnchangegroup(ui, repo, node, **kwargs): ui.write("Error message 1\n") ui.warn("Error message 2\n") ui.status("Error message 3\n") #raise Exception("Error\n") return True }}}

Raising exception in hook is also not option because of lost output to ui.

Comments (9)

  1. Dmitry Zanozin

    Continue here as my issue report #2130 duplicate this one:

    Yuya, I understand your position described in the mentioned thread above. But I don't agree that "there's no easy and reliable way to detect push failure. The return code 1 doesn't _always_ mean an error".

    As I know there are much less non-error reasons for code 1 than error ones. We can check special events for code 1 like "no changes found" via hg output and treat all others as errors.

  2. Yuya Nishihara

    Error message is translated to any languages. We cannot rely on it.

    Instead, I'm trying to make a patch that fixes hgweb to report "ssl required" as 403 error.

  3. Yuya Nishihara

    warning in yellow with comment: "Nothing was pushed, see log for details"

    Good idea. Anyway I just need to implement warning-level message bar to inform "succeeded, but it might be what you want" state.

  4. Fredrik Håård

    This is a huge problem in a Windows environment where people are not used to console (i.e: where you need THG), that errors cannot be reported but are hidden by the UI.

    I believe that this used to work? We've had pretxn hooks preventing erronous pushes for a while and this only became a problem recently.

    Would it be possible to add a way to explicitly trigger error handling (e.g, putting 'Error:' in the output), in addition to Dmitry's suggestion?

  5. Log in to comment