From fe1dbe120c9905324026fa503ac1690dc96e16e2 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Thu, 2 May 2019 04:43:57 +0000 Subject: [PATCH] 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 Reviewed-by: Dirk Pranke Commit-Queue: Raul Tambre --- git_cl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git_cl.py b/git_cl.py index 662c28e79..85b212c7e 100755 --- a/git_cl.py +++ b/git_cl.py @@ -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/',