Commit fe1dbe12 authored by Raul Tambre's avatar Raul Tambre Committed by Commit Bot

Fix always false 'is not' comparison with a literal

The 'is' operator compares references, so a comparison with a string literal will always be false.

Found while using Python 3.8:

C:\Google\depot_tools/git_cl.py:1265: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if remote is not '.':
Change-Id: Ia77a1b350a3f0a2fe3c398e9a3b9aac8cfe38d4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1591516
Auto-Submit: Raul Tambre <raul@tambre.ee>
Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
parent 020b429f
......@@ -1262,7 +1262,7 @@ class Changelist(object):
def GetUpstreamBranch(self):
if self.upstream_branch is None:
remote, upstream_branch = self.FetchUpstreamTuple(self.GetBranch())
if remote is not '.':
if remote != '.':
upstream_branch = upstream_branch.replace('refs/heads/',
'refs/remotes/%s/' % remote)
upstream_branch = upstream_branch.replace('refs/branch-heads/',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment