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: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
changes/16/1591516/2
Raul Tambre 6 years ago committed by Commit Bot
parent 020b429fbf
commit fe1dbe120c

@ -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/',

Loading…
Cancel
Save