Fix a bug with author information for rbt land.

Review Request #14770 — Created Jan. 9, 2026 and submitted

Information

RBTools
master

Reviewers

Our BaseSCMClient.merge and BaseSCMClient.create_commit methods
type the author argument as PatchAuthor. However, in our land
command, we actually pass a UserItemResource which we get from
review_request.get_submitter(). This was made evident in a bug where
rbt land would emit a warning about the author's profile being private
even though it wasn't. This happened because we try to access
author.full_name, which doesn't exist on the user resource.

This change addresses that bug and improves our handling of the case
where author information isn't available. Now the author argument
for these methods can be None, indicating that the author information
isn't available. All the SCM clients have been updated to handle this
accordingly.

The Git and Mercurial clients actually already had a unit test for this
case, and one has been added for Jujutsu.

This change also adds typing to the land command.

  • Ran unit tests.
  • Saw that the bug I was hitting with rbt land went away.

I don't have Jujutsu or Mercurial set up on my system so I
actually don't know if their unit tests for this pass. If possible
could someone apply this patch and confirm that the unit tests pass.

Summary ID
Fix a bug with author information for rbt land.
Our `BaseSCMClient.merge` and `BaseSCMClient.create_commit` methods type the `author` argument as `PatchAuthor`. However, in our land command, we actually pass a `UserItemResource` which we get from `review_request.get_submitter()`. This was made evident in a bug where `rbt land` would emit a warning about the author's profile being private even though it wasn't. This happened because we use `author.full_name`, which doesn't exist on the user resource. This change addresses that bug and improves our handling of the case where author information isn't available. Now the `author` argument can be `None`, indicating that the author information isn't available. All the SCM clients have been updated to handle this accordingly. This change also adds typing to the land command.
28825c6e2f561e12fd395b6685ed9f92dbac7127
Description From Last Updated

Can you update this to be rbtools.diffs.patches.PatchAuthor?

daviddavid

We don't need the parens around the type here.

daviddavid

Shouldn't this be passing author=None?

daviddavid

By default create_commit will call jj new at the end. I think instead of assertSpyLastCalledWith we should just use assertSpyCalledWith

daviddavid

Same on this one.

daviddavid
david
  1. 
      
  2. rbtools/clients/base/scmclient.py (Diff revision 1)
     
     
    Show all issues

    Can you update this to be rbtools.diffs.patches.PatchAuthor?

  3. rbtools/clients/git.py (Diff revision 1)
     
     
    Show all issues

    We don't need the parens around the type here.

  4. rbtools/clients/tests/test_jujutsu.py (Diff revision 1)
     
     
     
    Show all issues

    Shouldn't this be passing author=None?

  5. 
      
maubin
david
  1. Ran the hg and jj tests. Two failing tests, with an easy fix:

    1. Thanks for checking.

  2. rbtools/clients/tests/test_jujutsu.py (Diff revision 2)
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    By default create_commit will call jj new at the end. I think instead of assertSpyLastCalledWith we should just use assertSpyCalledWith

  3. rbtools/clients/tests/test_jujutsu.py (Diff revision 2)
     
     
    Show all issues

    Same on this one.

  4. 
      
maubin
david
  1. Ship It!
  2. 
      
maubin
Review request changed
Status:
Completed
Change Summary:
Pushed to master (f666029)