Improve style of boolean expr in states.git.latest

* `== None` -> `is None`
* `not X == Y` -> `X != Y`
Merge pull request #4843 from cvrebert/patch-1

Improve style of boolean expr in states.git.latest