Use pylint 2.7 for depot_tools
This includes a few fixes for specific errors, and disables several new
warnings introduced in this version, in order to allow for an incremental migration.
Bug:1262286
Change-Id: I4b8f8fc521386419a3121bbb07edc8ac83170a94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3413679
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
diff --git a/gclient_scm.py b/gclient_scm.py
index d79f07e..41e8e92 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -165,10 +165,10 @@
if actual_remote_url:
return (gclient_utils.SplitUrlRevision(actual_remote_url)[0].rstrip('/')
== gclient_utils.SplitUrlRevision(self.url)[0].rstrip('/'))
- else:
- # This may occur if the self.checkout_path exists but does not contain a
- # valid git checkout.
- return False
+
+ # This may occur if the self.checkout_path exists but does not contain a
+ # valid git checkout.
+ return False
def _DeleteOrMove(self, force):
"""Delete the checkout directory or move it out of the way.
@@ -381,7 +381,8 @@
if not target_rev:
raise gclient_utils.Error('A target revision for the patch must be given')
- elif target_rev.startswith(('refs/heads/', 'refs/branch-heads')):
+
+ if target_rev.startswith(('refs/heads/', 'refs/branch-heads')):
# If |target_rev| is in refs/heads/** or refs/branch-heads/**, try first
# to find the corresponding remote ref for it, since |target_rev| might
# point to a local ref which is not up to date with the corresponding
@@ -781,16 +782,18 @@
printed_path=printed_path, merge=False)
printed_path = True
break
- elif re.match(r'quit|q', action, re.I):
+
+ if re.match(r'quit|q', action, re.I):
raise gclient_utils.Error("Can't fast-forward, please merge or "
"rebase manually.\n"
"cd %s && git " % self.checkout_path
+ "rebase %s" % upstream_branch)
- elif re.match(r'skip|s', action, re.I):
+
+ if re.match(r'skip|s', action, re.I):
self.Print('Skipping %s' % self.relpath)
return
- else:
- self.Print('Input not recognized')
+
+ self.Print('Input not recognized')
elif re.match(b"error: Your local changes to '.*' would be "
b"overwritten by merge. Aborting.\nPlease, commit your "
b"changes or stash them before you can merge.\n",
@@ -1137,16 +1140,18 @@
# Should this be recursive?
rebase_output = scm.GIT.Capture(rebase_cmd, cwd=self.checkout_path)
break
- elif re.match(r'quit|q', rebase_action, re.I):
+
+ if re.match(r'quit|q', rebase_action, re.I):
raise gclient_utils.Error("Please merge or rebase manually\n"
"cd %s && git " % self.checkout_path
+ "%s" % ' '.join(rebase_cmd))
- elif re.match(r'show|s', rebase_action, re.I):
+
+ if re.match(r'show|s', rebase_action, re.I):
self.Print('%s' % e.stderr.decode('utf-8').strip())
continue
- else:
- gclient_utils.Error("Input not recognized")
- continue
+
+ gclient_utils.Error("Input not recognized")
+ continue
elif re.search(br'^CONFLICT', e.stdout, re.M):
raise gclient_utils.Error("Conflict while rebasing this branch.\n"
"Fix the conflict and run gclient again.\n"
@@ -1559,15 +1564,12 @@
CIPD packages should be reverted at the root by running
`CipdRoot.run('revert')`.
"""
- pass
def diff(self, options, args, file_list):
"""CIPD has no notion of diffing."""
- pass
def pack(self, options, args, file_list):
"""CIPD has no notion of diffing."""
- pass
def revinfo(self, options, args, file_list):
"""Grab the instance ID."""
@@ -1597,4 +1599,3 @@
CIPD packages should be updated at the root by running
`CipdRoot.run('update')`.
"""
- pass