Add Mercurial support in rbt land.

Review Request #10678 — Created Sept. 2, 2019 and submitted

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.

Description From Last Updated

-l/--list appears to be Mercurial 5.0+ only. Aditionally, hg bookmark -q <rev> will update to that bookmark, which you probably ...

brenniebrennie

E703 statement ends with a semicolon

reviewbotreviewbot

E703 statement ends with a semicolon

reviewbotreviewbot

E703 statement ends with a semicolon

reviewbotreviewbot

E703 statement ends with a semicolon

reviewbotreviewbot
david
  1. Ship It!
  2. 
      
brennie
  1. 
      
  2. rbtools/clients/mercurial.py (Diff revision 1)
     
     

    -l/--list appears to be Mercurial 5.0+ only.

    Aditionally, hg bookmark -q <rev> will update to that bookmark, which you probably don't want to do.

    You can also do hg log -r 'bookmark(REV) which will return non-zero if REV is not a bookmark. By default it otputs the default template, but you can get less output with -q.

  3. 
      
chipx86
Review request changed

Change Summary:

  • Switch bookmark and tag lookup to use hg log. Note that branches cannot be looked up the same way.

Commit:

-ebfa00200ae05acd62f1c246c77a180c01578661
+128c51ba4398e06355c474758774feeebba78d9e

Diff:

Revision 2 (+456 -51)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

chipx86
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-1.0.x (2287f6e)
Loading...