sigmavirus24 / github3.py

Hi, I'm a library for interacting with GItHub's REST API in a convenient and ergonomic way. I work on Python 3.6+.
https://github3.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.21k stars 402 forks source link

Branch latest SHA and `differs_from` keyword argument #1125

Closed kamilturek closed 1 year ago

kamilturek commented 1 year ago

Hello 👋

  1. I've noticed that the latest_sha method from the branch class is not documented. Is it intentional? Should this method be avoided? Or can it be added to the documentation?
  2. What is the purpose of the differs_from keyword argument? Not sure if I understand it well. Does it work correctly?

Many thanks!

sigmavirus24 commented 1 year ago

It's supported and intended to be documented (as there's a docstring): https://github.com/sigmavirus24/github3.py/blob/e06c5199b4eedcad7505f37796964ab86ec6316a/src/github3/repos/branch.py#L37

differs_from is for a very specific use-case. Let's say that you have a (very very very) long running process and you've retrieved that Branch object already way in the past. You can call b.differs_from(b.commit.sha) to determine if the branch on GitHub has new commits or has been changed.