Add Mercurial support in rbt land.

Review Request #10678 — Created Sept. 3, 2019 and submitted — Latest diff uploaded

chipx86
RBTools
release-1.0.x
691c13f...
rbtools

rbt land has historically only worked with Git, and had some Gitisms
in its implementation. For instance, it assumed that after merging a
branch, the branch would always be deleted as a separate step, unrelated
to the merge, which isn't the case with traditional branches in
Mercurial (you'd close the branch as a separate operation). This, along
with the differences between branches and bookmarks, made it a little
wonky to support Mercurial.

This change introduces full support for Mercurial in rbt land,
reworking some of the core landing and merging support and client
capability flags accordingly.

Now, rbt land can correctly land changes living in review requests, in
branches, or in bookmarks to a destination branch. This works much like
it does for Git, from a user's perspective, with the exception that
commits won't be squashed in Mercurial. This could theoretically be
added, but seems to go against the spirit of Mercurial a bit.

Behind the scenes, SCMClient.merge now takes a close_branch
argument, which is responsible for deleting/closing a branch. This
replaces a separate call to SCMClient.delete_branch(), giving the
client more control of the order of operations.

MercurialClient also has some new functionality to determine if a
reference identifies a branch, bookmark, tag, or revision, allowing us
to easily choose whether to interact with hg branch, hg bookmark, or
another command.

This does not support --push at this time.

Unit tests pass.

Manually tested landing a Mercurial change from a review request, branch,
and bookmark, with and without editing commits.

Loading...