1. TortoiseHg
  2. TortoiseHg
  3. thg
  4. Issues
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: {{{


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 (14)

  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

    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.

  3. 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?

  4. plum117

    Can someone from this thread can confirm to me if the error message "remote: Commit failed" shown in the console will actually be triggering a popup to the user to make sure he knows clearly about a failing push?

  5. muxator


    this bug seems to be solved as of thg 4.0 (remote hg server 4.0 as well).

    I just tried to push to a repository whose hgrc contained:

    pretxnchangegroup = fail.sh

    where the hook is:


    TortoiseHG aborted with the following error: "abort: push failed on remote"

    An annoyance still remaining is that when the hook sends back a message, that message is not displayed in the red bar. The user will have to open the console.


  6. Yuya Nishihara

    Yeah, this issue appears to be partly solved. If the remote server supports new bundle (bundle2) format, "push failed on remote" will be displayed.

    Anyway, we'll want to capture the message sent from the remote hooks.

  7. Log in to comment