diff options
-rw-r--r-- | color.py | 5 | ||||
-rw-r--r-- | command.py | 2 | ||||
-rw-r--r-- | git_command.py | 6 | ||||
-rw-r--r-- | git_config.py | 5 | ||||
-rw-r--r-- | git_refs.py | 4 | ||||
-rwxr-xr-x | main.py | 1 | ||||
-rw-r--r-- | manifest_xml.py | 2 | ||||
-rw-r--r-- | project.py | 15 | ||||
-rw-r--r-- | subcmds/grep.py | 2 | ||||
-rw-r--r-- | subcmds/init.py | 2 | ||||
-rw-r--r-- | subcmds/sync.py | 2 | ||||
-rw-r--r-- | subcmds/upload.py | 2 |
12 files changed, 24 insertions, 24 deletions
@@ -36,7 +36,8 @@ ATTRS = {None :-1, | |||
36 | 'blink' : 5, | 36 | 'blink' : 5, |
37 | 'reverse': 7} | 37 | 'reverse': 7} |
38 | 38 | ||
39 | RESET = "\033[m" | 39 | RESET = "\033[m" # pylint: disable=W1401 |
40 | # backslash is not anomalous | ||
40 | 41 | ||
41 | def is_color(s): | 42 | def is_color(s): |
42 | return s in COLORS | 43 | return s in COLORS |
@@ -51,7 +52,7 @@ def _Color(fg = None, bg = None, attr = None): | |||
51 | 52 | ||
52 | if attr >= 0 or fg >= 0 or bg >= 0: | 53 | if attr >= 0 or fg >= 0 or bg >= 0: |
53 | need_sep = False | 54 | need_sep = False |
54 | code = "\033[" | 55 | code = "\033[" #pylint: disable=W1401 |
55 | 56 | ||
56 | if attr >= 0: | 57 | if attr >= 0: |
57 | code += chr(ord('0') + attr) | 58 | code += chr(ord('0') + attr) |
@@ -71,7 +71,7 @@ class Command(object): | |||
71 | groups = mp.config.GetString('manifest.groups') | 71 | groups = mp.config.GetString('manifest.groups') |
72 | if not groups: | 72 | if not groups: |
73 | groups = 'all,-notdefault,platform-' + platform.system().lower() | 73 | groups = 'all,-notdefault,platform-' + platform.system().lower() |
74 | groups = [x for x in re.split('[,\s]+', groups) if x] | 74 | groups = [x for x in re.split(r'[,\s]+', groups) if x] |
75 | 75 | ||
76 | if not args: | 76 | if not args: |
77 | for project in all_projects.values(): | 77 | for project in all_projects.values(): |
diff --git a/git_command.py b/git_command.py index a40e6c05..39f795ff 100644 --- a/git_command.py +++ b/git_command.py | |||
@@ -132,15 +132,15 @@ class GitCommand(object): | |||
132 | gitdir = None): | 132 | gitdir = None): |
133 | env = os.environ.copy() | 133 | env = os.environ.copy() |
134 | 134 | ||
135 | for e in [REPO_TRACE, | 135 | for key in [REPO_TRACE, |
136 | GIT_DIR, | 136 | GIT_DIR, |
137 | 'GIT_ALTERNATE_OBJECT_DIRECTORIES', | 137 | 'GIT_ALTERNATE_OBJECT_DIRECTORIES', |
138 | 'GIT_OBJECT_DIRECTORY', | 138 | 'GIT_OBJECT_DIRECTORY', |
139 | 'GIT_WORK_TREE', | 139 | 'GIT_WORK_TREE', |
140 | 'GIT_GRAFT_FILE', | 140 | 'GIT_GRAFT_FILE', |
141 | 'GIT_INDEX_FILE']: | 141 | 'GIT_INDEX_FILE']: |
142 | if e in env: | 142 | if key in env: |
143 | del env[e] | 143 | del env[key] |
144 | 144 | ||
145 | if disable_editor: | 145 | if disable_editor: |
146 | _setenv(env, 'GIT_EDITOR', ':') | 146 | _setenv(env, 'GIT_EDITOR', ':') |
diff --git a/git_config.py b/git_config.py index ae288558..d6510aae 100644 --- a/git_config.py +++ b/git_config.py | |||
@@ -35,7 +35,7 @@ from git_command import terminate_ssh_clients | |||
35 | 35 | ||
36 | R_HEADS = 'refs/heads/' | 36 | R_HEADS = 'refs/heads/' |
37 | R_TAGS = 'refs/tags/' | 37 | R_TAGS = 'refs/tags/' |
38 | ID_RE = re.compile('^[0-9a-f]{40}$') | 38 | ID_RE = re.compile(r'^[0-9a-f]{40}$') |
39 | 39 | ||
40 | REVIEW_CACHE = dict() | 40 | REVIEW_CACHE = dict() |
41 | 41 | ||
@@ -288,7 +288,8 @@ class GitConfig(object): | |||
288 | d = self._do('--null', '--list') | 288 | d = self._do('--null', '--list') |
289 | if d is None: | 289 | if d is None: |
290 | return c | 290 | return c |
291 | for line in d.rstrip('\0').split('\0'): | 291 | for line in d.rstrip('\0').split('\0'): # pylint: disable=W1401 |
292 | # Backslash is not anomalous | ||
292 | if '\n' in line: | 293 | if '\n' in line: |
293 | key, val = line.split('\n', 1) | 294 | key, val = line.split('\n', 1) |
294 | else: | 295 | else: |
diff --git a/git_refs.py b/git_refs.py index 18c9230c..cfeffba9 100644 --- a/git_refs.py +++ b/git_refs.py | |||
@@ -138,14 +138,14 @@ class GitRefs(object): | |||
138 | def _ReadLoose1(self, path, name): | 138 | def _ReadLoose1(self, path, name): |
139 | try: | 139 | try: |
140 | fd = open(path, 'rb') | 140 | fd = open(path, 'rb') |
141 | except: | 141 | except IOError: |
142 | return | 142 | return |
143 | 143 | ||
144 | try: | 144 | try: |
145 | try: | 145 | try: |
146 | mtime = os.path.getmtime(path) | 146 | mtime = os.path.getmtime(path) |
147 | ref_id = fd.readline() | 147 | ref_id = fd.readline() |
148 | except: | 148 | except (IOError, OSError): |
149 | return | 149 | return |
150 | finally: | 150 | finally: |
151 | fd.close() | 151 | fd.close() |
@@ -27,7 +27,6 @@ import imp | |||
27 | import netrc | 27 | import netrc |
28 | import optparse | 28 | import optparse |
29 | import os | 29 | import os |
30 | import re | ||
31 | import sys | 30 | import sys |
32 | import time | 31 | import time |
33 | import urllib2 | 32 | import urllib2 |
diff --git a/manifest_xml.py b/manifest_xml.py index dd163bed..cdee87a6 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -584,7 +584,7 @@ class XmlManifest(object): | |||
584 | groups = '' | 584 | groups = '' |
585 | if node.hasAttribute('groups'): | 585 | if node.hasAttribute('groups'): |
586 | groups = node.getAttribute('groups') | 586 | groups = node.getAttribute('groups') |
587 | groups = [x for x in re.split('[,\s]+', groups) if x] | 587 | groups = [x for x in re.split(r'[,\s]+', groups) if x] |
588 | 588 | ||
589 | default_groups = ['all', 'name:%s' % name, 'path:%s' % path] | 589 | default_groups = ['all', 'name:%s' % name, 'path:%s' % path] |
590 | groups.extend(set(default_groups).difference(groups)) | 590 | groups.extend(set(default_groups).difference(groups)) |
@@ -1012,6 +1012,10 @@ class Project(object): | |||
1012 | self.CleanPublishedCache(all_refs) | 1012 | self.CleanPublishedCache(all_refs) |
1013 | revid = self.GetRevisionId(all_refs) | 1013 | revid = self.GetRevisionId(all_refs) |
1014 | 1014 | ||
1015 | def _doff(): | ||
1016 | self._FastForward(revid) | ||
1017 | self._CopyFiles() | ||
1018 | |||
1015 | self._InitWorkTree() | 1019 | self._InitWorkTree() |
1016 | head = self.work_git.GetHead() | 1020 | head = self.work_git.GetHead() |
1017 | if head.startswith(R_HEADS): | 1021 | if head.startswith(R_HEADS): |
@@ -1090,9 +1094,6 @@ class Project(object): | |||
1090 | # All published commits are merged, and thus we are a | 1094 | # All published commits are merged, and thus we are a |
1091 | # strict subset. We can fast-forward safely. | 1095 | # strict subset. We can fast-forward safely. |
1092 | # | 1096 | # |
1093 | def _doff(): | ||
1094 | self._FastForward(revid) | ||
1095 | self._CopyFiles() | ||
1096 | syncbuf.later1(self, _doff) | 1097 | syncbuf.later1(self, _doff) |
1097 | return | 1098 | return |
1098 | 1099 | ||
@@ -1155,9 +1156,6 @@ class Project(object): | |||
1155 | syncbuf.fail(self, e) | 1156 | syncbuf.fail(self, e) |
1156 | return | 1157 | return |
1157 | else: | 1158 | else: |
1158 | def _doff(): | ||
1159 | self._FastForward(revid) | ||
1160 | self._CopyFiles() | ||
1161 | syncbuf.later1(self, _doff) | 1159 | syncbuf.later1(self, _doff) |
1162 | 1160 | ||
1163 | def AddCopyFile(self, src, dest, absdest): | 1161 | def AddCopyFile(self, src, dest, absdest): |
@@ -1836,7 +1834,8 @@ class Project(object): | |||
1836 | if p.Wait() == 0: | 1834 | if p.Wait() == 0: |
1837 | out = p.stdout | 1835 | out = p.stdout |
1838 | if out: | 1836 | if out: |
1839 | return out[:-1].split("\0") | 1837 | return out[:-1].split('\0') # pylint: disable=W1401 |
1838 | # Backslash is not anomalous | ||
1840 | return [] | 1839 | return [] |
1841 | 1840 | ||
1842 | def DiffZ(self, name, *args): | 1841 | def DiffZ(self, name, *args): |
@@ -1852,7 +1851,7 @@ class Project(object): | |||
1852 | out = p.process.stdout.read() | 1851 | out = p.process.stdout.read() |
1853 | r = {} | 1852 | r = {} |
1854 | if out: | 1853 | if out: |
1855 | out = iter(out[:-1].split('\0')) | 1854 | out = iter(out[:-1].split('\0')) # pylint: disable=W1401 |
1856 | while out: | 1855 | while out: |
1857 | try: | 1856 | try: |
1858 | info = out.next() | 1857 | info = out.next() |
diff --git a/subcmds/grep.py b/subcmds/grep.py index 0dc8f9f6..b067629a 100644 --- a/subcmds/grep.py +++ b/subcmds/grep.py | |||
@@ -51,7 +51,7 @@ Examples | |||
51 | 51 | ||
52 | Look for a line that has '#define' and either 'MAX_PATH or 'PATH_MAX': | 52 | Look for a line that has '#define' and either 'MAX_PATH or 'PATH_MAX': |
53 | 53 | ||
54 | repo grep -e '#define' --and -\( -e MAX_PATH -e PATH_MAX \) | 54 | repo grep -e '#define' --and -\\( -e MAX_PATH -e PATH_MAX \\) |
55 | 55 | ||
56 | Look for a line that has 'NODE' or 'Unexpected' in files that | 56 | Look for a line that has 'NODE' or 'Unexpected' in files that |
57 | contain a line that matches both expressions: | 57 | contain a line that matches both expressions: |
diff --git a/subcmds/init.py b/subcmds/init.py index e56b9223..48df9e89 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -147,7 +147,7 @@ to update the working directory files. | |||
147 | r.ResetFetch() | 147 | r.ResetFetch() |
148 | r.Save() | 148 | r.Save() |
149 | 149 | ||
150 | groups = re.split('[,\s]+', opt.groups) | 150 | groups = re.split(r'[,\s]+', opt.groups) |
151 | all_platforms = ['linux', 'darwin'] | 151 | all_platforms = ['linux', 'darwin'] |
152 | platformize = lambda x: 'platform-' + x | 152 | platformize = lambda x: 'platform-' + x |
153 | if opt.platform == 'auto': | 153 | if opt.platform == 'auto': |
diff --git a/subcmds/sync.py b/subcmds/sync.py index d4637d0c..8e9477a3 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -696,7 +696,7 @@ class _FetchTimes(object): | |||
696 | try: | 696 | try: |
697 | try: | 697 | try: |
698 | self._times = pickle.load(f) | 698 | self._times = pickle.load(f) |
699 | except: | 699 | except IOError: |
700 | try: | 700 | try: |
701 | os.remove(self._path) | 701 | os.remove(self._path) |
702 | except OSError: | 702 | except OSError: |
diff --git a/subcmds/upload.py b/subcmds/upload.py index 84a5e440..39721ac2 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -297,7 +297,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
297 | try: | 297 | try: |
298 | # refs/changes/XYZ/N --> XYZ | 298 | # refs/changes/XYZ/N --> XYZ |
299 | return refs.get(last_pub).split('/')[-2] | 299 | return refs.get(last_pub).split('/')[-2] |
300 | except: | 300 | except (AttributeError, IndexError): |
301 | return "" | 301 | return "" |
302 | 302 | ||
303 | def _UploadAndReport(self, opt, todo, original_people): | 303 | def _UploadAndReport(self, opt, todo, original_people): |