Hank
Hank

Reputation: 8477

Mercurial command-line "API" reference?

I'm working on a Mercurial GUI client that interacts with hg.exe through the command line (the preferred high-level API, as I understand it).

However, I am having trouble determining the possible outputs of each command. I can see several outputs by simulating situations, but I was wondering if there is a complete reference of the possible outputs for each command.

For instance, for the command hg fetch, some possible outputs are:

pulling from https://[email protected]/Repo
searching for changes
no changes found

if there are no changes, or:

abort: outstanding uncommitted changes

or one of several other messages, depending on the situation.

I would like to structure my program to handle as many of these cases as possible, but it's hard for me to know in advance what they all are.

Is there a documented reference for the command-line? I have not been able to find one with The Google.

Upvotes: 2

Views: 686

Answers (3)

c4baf058
c4baf058

Reputation: 225

Mercurial 1.9 brings a command server, a stable (in a sense that API doesn't change that much) and low overhead (there is no need to run hg process for every command). The communication is done via a pipe.

Upvotes: 0

Chriseyre2000
Chriseyre2000

Reputation: 2053

Is this what you were looking for: https://www.mercurial-scm.org/wiki/MercurialBook ?

Upvotes: 0

Ry4an Brase
Ry4an Brase

Reputation: 78330

Look through the translation strings file. Then you'll know you have every message handled and be able to see what parts of it vary.

Also, fetch is just a convenience wrapper around pull/update/merge. If you're invoking mercurial programmatically you probably want to keep those three very different concepts separate in your running it so you know which part failed. In your example above it's the 'update' failing, so the 'pull' would have succeeded and the 'update's failing would allow you to provide the user with a better message.

(fetch is an abomination, which is part of why it's disabled by default)

Upvotes: 1

Related Questions