summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConley Owens <cco3@android.com>2012-10-09 14:29:46 -0700
committerGerrit Code Review <noreply-gerritcodereview@google.com>2012-10-09 14:29:46 -0700
commit3a6cd4200e42fbb5a21b3fb8d3c9738c0320cc63 (patch)
tree68ae5094d6530453887fb35a73fd5fa55f55a034
parent25f17682ca4ecd8acc887462d4bebc7c429cf110 (diff)
parent8a68ff96057ec58e524a3e41a2d8dca7b5d016bc (diff)
downloadgit-repo-3a6cd4200e42fbb5a21b3fb8d3c9738c0320cc63.tar.gz
Merge "Coding style cleanup"
-rw-r--r--color.py21
-rw-r--r--command.py8
-rw-r--r--error.py4
-rw-r--r--git_config.py32
-rw-r--r--git_refs.py16
-rwxr-xr-xmain.py10
-rw-r--r--manifest_xml.py3
-rwxr-xr-xpager.py4
-rw-r--r--project.py119
-rw-r--r--subcmds/branches.py8
-rw-r--r--subcmds/forall.py7
-rw-r--r--subcmds/help.py6
-rw-r--r--subcmds/init.py8
-rw-r--r--subcmds/manifest.py6
-rw-r--r--subcmds/overview.py10
-rw-r--r--subcmds/prune.py10
-rw-r--r--subcmds/rebase.py6
-rw-r--r--subcmds/stage.py14
-rw-r--r--subcmds/start.py6
-rw-r--r--subcmds/status.py8
-rw-r--r--subcmds/sync.py13
-rw-r--r--subcmds/upload.py20
22 files changed, 167 insertions, 172 deletions
diff --git a/color.py b/color.py
index 9b3365be..9200a298 100644
--- a/color.py
+++ b/color.py
@@ -38,8 +38,11 @@ ATTRS = {None :-1,
38 38
39RESET = "\033[m" 39RESET = "\033[m"
40 40
41def is_color(s): return s in COLORS 41def is_color(s):
42def is_attr(s): return s in ATTRS 42 return s in COLORS
43
44def is_attr(s):
45 return s in ATTRS
43 46
44def _Color(fg = None, bg = None, attr = None): 47def _Color(fg = None, bg = None, attr = None):
45 fg = COLORS[fg] 48 fg = COLORS[fg]
@@ -80,8 +83,8 @@ def _Color(fg = None, bg = None, attr = None):
80 83
81 84
82class Coloring(object): 85class Coloring(object):
83 def __init__(self, config, type): 86 def __init__(self, config, section_type):
84 self._section = 'color.%s' % type 87 self._section = 'color.%s' % section_type
85 self._config = config 88 self._config = config
86 self._out = sys.stdout 89 self._out = sys.stdout
87 90
@@ -126,8 +129,8 @@ class Coloring(object):
126 if self._on: 129 if self._on:
127 c = self._parse(opt, fg, bg, attr) 130 c = self._parse(opt, fg, bg, attr)
128 def f(fmt, *args): 131 def f(fmt, *args):
129 str = fmt % args 132 output = fmt % args
130 return ''.join([c, str, RESET]) 133 return ''.join([c, output, RESET])
131 return f 134 return f
132 else: 135 else:
133 def f(fmt, *args): 136 def f(fmt, *args):
@@ -151,8 +154,10 @@ class Coloring(object):
151 have_fg = False 154 have_fg = False
152 for a in v.split(' '): 155 for a in v.split(' '):
153 if is_color(a): 156 if is_color(a):
154 if have_fg: bg = a 157 if have_fg:
155 else: fg = a 158 bg = a
159 else:
160 fg = a
156 elif is_attr(a): 161 elif is_attr(a):
157 attr = a 162 attr = a
158 163
diff --git a/command.py b/command.py
index 5789582c..e17f0ab9 100644
--- a/command.py
+++ b/command.py
@@ -63,7 +63,7 @@ class Command(object):
63 def GetProjects(self, args, missing_ok=False): 63 def GetProjects(self, args, missing_ok=False):
64 """A list of projects that match the arguments. 64 """A list of projects that match the arguments.
65 """ 65 """
66 all = self.manifest.projects 66 all_projects = self.manifest.projects
67 result = [] 67 result = []
68 68
69 mp = self.manifest.manifestProject 69 mp = self.manifest.manifestProject
@@ -74,7 +74,7 @@ class Command(object):
74 groups = [x for x in re.split('[,\s]+', groups) if x] 74 groups = [x for x in re.split('[,\s]+', groups) if x]
75 75
76 if not args: 76 if not args:
77 for project in all.values(): 77 for project in all_projects.values():
78 if ((missing_ok or project.Exists) and 78 if ((missing_ok or project.Exists) and
79 project.MatchesGroups(groups)): 79 project.MatchesGroups(groups)):
80 result.append(project) 80 result.append(project)
@@ -82,14 +82,14 @@ class Command(object):
82 by_path = None 82 by_path = None
83 83
84 for arg in args: 84 for arg in args:
85 project = all.get(arg) 85 project = all_projects.get(arg)
86 86
87 if not project: 87 if not project:
88 path = os.path.abspath(arg).replace('\\', '/') 88 path = os.path.abspath(arg).replace('\\', '/')
89 89
90 if not by_path: 90 if not by_path:
91 by_path = dict() 91 by_path = dict()
92 for p in all.values(): 92 for p in all_projects.values():
93 by_path[p.worktree] = p 93 by_path[p.worktree] = p
94 94
95 if os.path.exists(path): 95 if os.path.exists(path):
diff --git a/error.py b/error.py
index 48e3189c..783ab7d2 100644
--- a/error.py
+++ b/error.py
@@ -85,8 +85,8 @@ class RepoChangedException(Exception):
85 repo or manifest repositories. In this special case we must 85 repo or manifest repositories. In this special case we must
86 use exec to re-execute repo with the new code and manifest. 86 use exec to re-execute repo with the new code and manifest.
87 """ 87 """
88 def __init__(self, extra_args=[]): 88 def __init__(self, extra_args=None):
89 self.extra_args = extra_args 89 self.extra_args = extra_args or []
90 90
91class HookError(Exception): 91class HookError(Exception):
92 """Thrown if a 'repo-hook' could not be run. 92 """Thrown if a 'repo-hook' could not be run.
diff --git a/git_config.py b/git_config.py
index eb532d02..afaa6f15 100644
--- a/git_config.py
+++ b/git_config.py
@@ -56,16 +56,16 @@ class GitConfig(object):
56 @classmethod 56 @classmethod
57 def ForUser(cls): 57 def ForUser(cls):
58 if cls._ForUser is None: 58 if cls._ForUser is None:
59 cls._ForUser = cls(file = os.path.expanduser('~/.gitconfig')) 59 cls._ForUser = cls(configfile = os.path.expanduser('~/.gitconfig'))
60 return cls._ForUser 60 return cls._ForUser
61 61
62 @classmethod 62 @classmethod
63 def ForRepository(cls, gitdir, defaults=None): 63 def ForRepository(cls, gitdir, defaults=None):
64 return cls(file = os.path.join(gitdir, 'config'), 64 return cls(configfile = os.path.join(gitdir, 'config'),
65 defaults = defaults) 65 defaults = defaults)
66 66
67 def __init__(self, file, defaults=None, pickleFile=None): 67 def __init__(self, configfile, defaults=None, pickleFile=None):
68 self.file = file 68 self.file = configfile
69 self.defaults = defaults 69 self.defaults = defaults
70 self._cache_dict = None 70 self._cache_dict = None
71 self._section_dict = None 71 self._section_dict = None
@@ -104,20 +104,20 @@ class GitConfig(object):
104 return False 104 return False
105 return None 105 return None
106 106
107 def GetString(self, name, all=False): 107 def GetString(self, name, all_keys=False):
108 """Get the first value for a key, or None if it is not defined. 108 """Get the first value for a key, or None if it is not defined.
109 109
110 This configuration file is used first, if the key is not 110 This configuration file is used first, if the key is not
111 defined or all = True then the defaults are also searched. 111 defined or all_keys = True then the defaults are also searched.
112 """ 112 """
113 try: 113 try:
114 v = self._cache[_key(name)] 114 v = self._cache[_key(name)]
115 except KeyError: 115 except KeyError:
116 if self.defaults: 116 if self.defaults:
117 return self.defaults.GetString(name, all = all) 117 return self.defaults.GetString(name, all_keys = all_keys)
118 v = [] 118 v = []
119 119
120 if not all: 120 if not all_keys:
121 if v: 121 if v:
122 return v[0] 122 return v[0]
123 return None 123 return None
@@ -125,7 +125,7 @@ class GitConfig(object):
125 r = [] 125 r = []
126 r.extend(v) 126 r.extend(v)
127 if self.defaults: 127 if self.defaults:
128 r.extend(self.defaults.GetString(name, all = True)) 128 r.extend(self.defaults.GetString(name, all_keys = True))
129 return r 129 return r
130 130
131 def SetString(self, name, value): 131 def SetString(self, name, value):
@@ -526,7 +526,7 @@ class Remote(object):
526 self.review = self._Get('review') 526 self.review = self._Get('review')
527 self.projectname = self._Get('projectname') 527 self.projectname = self._Get('projectname')
528 self.fetch = map(lambda x: RefSpec.FromString(x), 528 self.fetch = map(lambda x: RefSpec.FromString(x),
529 self._Get('fetch', all=True)) 529 self._Get('fetch', all_keys=True))
530 self._review_url = None 530 self._review_url = None
531 531
532 def _InsteadOf(self): 532 def _InsteadOf(self):
@@ -537,7 +537,7 @@ class Remote(object):
537 537
538 for url in urlList: 538 for url in urlList:
539 key = "url." + url + ".insteadOf" 539 key = "url." + url + ".insteadOf"
540 insteadOfList = globCfg.GetString(key, all=True) 540 insteadOfList = globCfg.GetString(key, all_keys=True)
541 541
542 for insteadOf in insteadOfList: 542 for insteadOf in insteadOfList:
543 if self.url.startswith(insteadOf) \ 543 if self.url.startswith(insteadOf) \
@@ -567,7 +567,7 @@ class Remote(object):
567 if u.endswith('/ssh_info'): 567 if u.endswith('/ssh_info'):
568 u = u[:len(u) - len('/ssh_info')] 568 u = u[:len(u) - len('/ssh_info')]
569 if not u.endswith('/'): 569 if not u.endswith('/'):
570 u += '/' 570 u += '/'
571 http_url = u 571 http_url = u
572 572
573 if u in REVIEW_CACHE: 573 if u in REVIEW_CACHE:
@@ -651,9 +651,9 @@ class Remote(object):
651 key = 'remote.%s.%s' % (self.name, key) 651 key = 'remote.%s.%s' % (self.name, key)
652 return self._config.SetString(key, value) 652 return self._config.SetString(key, value)
653 653
654 def _Get(self, key, all=False): 654 def _Get(self, key, all_keys=False):
655 key = 'remote.%s.%s' % (self.name, key) 655 key = 'remote.%s.%s' % (self.name, key)
656 return self._config.GetString(key, all = all) 656 return self._config.GetString(key, all_keys = all_keys)
657 657
658 658
659class Branch(object): 659class Branch(object):
@@ -703,6 +703,6 @@ class Branch(object):
703 key = 'branch.%s.%s' % (self.name, key) 703 key = 'branch.%s.%s' % (self.name, key)
704 return self._config.SetString(key, value) 704 return self._config.SetString(key, value)
705 705
706 def _Get(self, key, all=False): 706 def _Get(self, key, all_keys=False):
707 key = 'branch.%s.%s' % (self.name, key) 707 key = 'branch.%s.%s' % (self.name, key)
708 return self._config.GetString(key, all = all) 708 return self._config.GetString(key, all_keys = all_keys)
diff --git a/git_refs.py b/git_refs.py
index 11241438..18c9230c 100644
--- a/git_refs.py
+++ b/git_refs.py
@@ -115,10 +115,10 @@ class GitRefs(object):
115 115
116 line = line[:-1] 116 line = line[:-1]
117 p = line.split(' ') 117 p = line.split(' ')
118 id = p[0] 118 ref_id = p[0]
119 name = p[1] 119 name = p[1]
120 120
121 self._phyref[name] = id 121 self._phyref[name] = ref_id
122 finally: 122 finally:
123 fd.close() 123 fd.close()
124 self._mtime['packed-refs'] = mtime 124 self._mtime['packed-refs'] = mtime
@@ -144,18 +144,18 @@ class GitRefs(object):
144 try: 144 try:
145 try: 145 try:
146 mtime = os.path.getmtime(path) 146 mtime = os.path.getmtime(path)
147 id = fd.readline() 147 ref_id = fd.readline()
148 except: 148 except:
149 return 149 return
150 finally: 150 finally:
151 fd.close() 151 fd.close()
152 152
153 if not id: 153 if not ref_id:
154 return 154 return
155 id = id[:-1] 155 ref_id = ref_id[:-1]
156 156
157 if id.startswith('ref: '): 157 if ref_id.startswith('ref: '):
158 self._symref[name] = id[5:] 158 self._symref[name] = ref_id[5:]
159 else: 159 else:
160 self._phyref[name] = id 160 self._phyref[name] = ref_id
161 self._mtime[name] = mtime 161 self._mtime[name] = mtime
diff --git a/main.py b/main.py
index 12752299..5c8772c6 100755
--- a/main.py
+++ b/main.py
@@ -88,7 +88,7 @@ class _Repo(object):
88 glob = argv 88 glob = argv
89 name = 'help' 89 name = 'help'
90 argv = [] 90 argv = []
91 gopts, gargs = global_options.parse_args(glob) 91 gopts, _gargs = global_options.parse_args(glob)
92 92
93 if gopts.trace: 93 if gopts.trace:
94 SetTrace() 94 SetTrace()
@@ -182,8 +182,8 @@ def _CheckWrapperVersion(ver, repo_path):
182 repo_path = '~/bin/repo' 182 repo_path = '~/bin/repo'
183 183
184 if not ver: 184 if not ver:
185 print >>sys.stderr, 'no --wrapper-version argument' 185 print >>sys.stderr, 'no --wrapper-version argument'
186 sys.exit(1) 186 sys.exit(1)
187 187
188 exp = _CurrentWrapperVersion() 188 exp = _CurrentWrapperVersion()
189 ver = tuple(map(lambda x: int(x), ver.split('.'))) 189 ver = tuple(map(lambda x: int(x), ver.split('.')))
@@ -211,8 +211,8 @@ def _CheckWrapperVersion(ver, repo_path):
211 211
212def _CheckRepoDir(dir): 212def _CheckRepoDir(dir):
213 if not dir: 213 if not dir:
214 print >>sys.stderr, 'no --repo-dir argument' 214 print >>sys.stderr, 'no --repo-dir argument'
215 sys.exit(1) 215 sys.exit(1)
216 216
217def _PruneOptions(argv, opt): 217def _PruneOptions(argv, opt):
218 i = 0 218 i = 0
diff --git a/manifest_xml.py b/manifest_xml.py
index a6364a77..12072441 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -113,7 +113,7 @@ class XmlManifest(object):
113 if os.path.exists(self.manifestFile): 113 if os.path.exists(self.manifestFile):
114 os.remove(self.manifestFile) 114 os.remove(self.manifestFile)
115 os.symlink('manifests/%s' % name, self.manifestFile) 115 os.symlink('manifests/%s' % name, self.manifestFile)
116 except OSError, e: 116 except OSError:
117 raise ManifestParseError('cannot link manifest %s' % name) 117 raise ManifestParseError('cannot link manifest %s' % name)
118 118
119 def _RemoteToXml(self, r, doc, root): 119 def _RemoteToXml(self, r, doc, root):
@@ -589,7 +589,6 @@ class XmlManifest(object):
589 groups.extend(set(default_groups).difference(groups)) 589 groups.extend(set(default_groups).difference(groups))
590 590
591 if self.IsMirror: 591 if self.IsMirror:
592 relpath = None
593 worktree = None 592 worktree = None
594 gitdir = os.path.join(self.topdir, '%s.git' % name) 593 gitdir = os.path.join(self.topdir, '%s.git' % name)
595 else: 594 else:
diff --git a/pager.py b/pager.py
index 7086aefa..888b108b 100755
--- a/pager.py
+++ b/pager.py
@@ -74,11 +74,11 @@ def _BecomePager(pager):
74 # ready works around a long-standing bug in popularly 74 # ready works around a long-standing bug in popularly
75 # available versions of 'less', a better 'more'. 75 # available versions of 'less', a better 'more'.
76 # 76 #
77 a, b, c = select.select([0], [], [0]) 77 _a, _b, _c = select.select([0], [], [0])
78 78
79 os.environ['LESS'] = 'FRSX' 79 os.environ['LESS'] = 'FRSX'
80 80
81 try: 81 try:
82 os.execvp(pager, [pager]) 82 os.execvp(pager, [pager])
83 except OSError, e: 83 except OSError:
84 os.execv('/bin/sh', ['sh', '-c', pager]) 84 os.execv('/bin/sh', ['sh', '-c', pager])
diff --git a/project.py b/project.py
index 04c43bb7..d81152cf 100644
--- a/project.py
+++ b/project.py
@@ -328,7 +328,6 @@ class RepoHook(object):
328 HookError: Raised if the user doesn't approve and abort_if_user_denies 328 HookError: Raised if the user doesn't approve and abort_if_user_denies
329 was passed to the consturctor. 329 was passed to the consturctor.
330 """ 330 """
331 hooks_dir = self._hooks_project.worktree
332 hooks_config = self._hooks_project.config 331 hooks_config = self._hooks_project.config
333 git_approval_key = 'repo.hooks.%s.approvedhash' % self._hook_type 332 git_approval_key = 'repo.hooks.%s.approvedhash' % self._hook_type
334 333
@@ -608,25 +607,24 @@ class Project(object):
608 """Get all existing local branches. 607 """Get all existing local branches.
609 """ 608 """
610 current = self.CurrentBranch 609 current = self.CurrentBranch
611 all = self._allrefs 610 all_refs = self._allrefs
612 heads = {} 611 heads = {}
613 pubd = {}
614 612
615 for name, id in all.iteritems(): 613 for name, ref_id in all_refs.iteritems():
616 if name.startswith(R_HEADS): 614 if name.startswith(R_HEADS):
617 name = name[len(R_HEADS):] 615 name = name[len(R_HEADS):]
618 b = self.GetBranch(name) 616 b = self.GetBranch(name)
619 b.current = name == current 617 b.current = name == current
620 b.published = None 618 b.published = None
621 b.revision = id 619 b.revision = ref_id
622 heads[name] = b 620 heads[name] = b
623 621
624 for name, id in all.iteritems(): 622 for name, ref_id in all_refs.iteritems():
625 if name.startswith(R_PUB): 623 if name.startswith(R_PUB):
626 name = name[len(R_PUB):] 624 name = name[len(R_PUB):]
627 b = heads.get(name) 625 b = heads.get(name)
628 if b: 626 if b:
629 b.published = id 627 b.published = ref_id
630 628
631 return heads 629 return heads
632 630
@@ -785,40 +783,40 @@ class Project(object):
785 783
786## Publish / Upload ## 784## Publish / Upload ##
787 785
788 def WasPublished(self, branch, all=None): 786 def WasPublished(self, branch, all_refs=None):
789 """Was the branch published (uploaded) for code review? 787 """Was the branch published (uploaded) for code review?
790 If so, returns the SHA-1 hash of the last published 788 If so, returns the SHA-1 hash of the last published
791 state for the branch. 789 state for the branch.
792 """ 790 """
793 key = R_PUB + branch 791 key = R_PUB + branch
794 if all is None: 792 if all_refs is None:
795 try: 793 try:
796 return self.bare_git.rev_parse(key) 794 return self.bare_git.rev_parse(key)
797 except GitError: 795 except GitError:
798 return None 796 return None
799 else: 797 else:
800 try: 798 try:
801 return all[key] 799 return all_refs[key]
802 except KeyError: 800 except KeyError:
803 return None 801 return None
804 802
805 def CleanPublishedCache(self, all=None): 803 def CleanPublishedCache(self, all_refs=None):
806 """Prunes any stale published refs. 804 """Prunes any stale published refs.
807 """ 805 """
808 if all is None: 806 if all_refs is None:
809 all = self._allrefs 807 all_refs = self._allrefs
810 heads = set() 808 heads = set()
811 canrm = {} 809 canrm = {}
812 for name, id in all.iteritems(): 810 for name, ref_id in all_refs.iteritems():
813 if name.startswith(R_HEADS): 811 if name.startswith(R_HEADS):
814 heads.add(name) 812 heads.add(name)
815 elif name.startswith(R_PUB): 813 elif name.startswith(R_PUB):
816 canrm[name] = id 814 canrm[name] = ref_id
817 815
818 for name, id in canrm.iteritems(): 816 for name, ref_id in canrm.iteritems():
819 n = name[len(R_PUB):] 817 n = name[len(R_PUB):]
820 if R_HEADS + n not in heads: 818 if R_HEADS + n not in heads:
821 self.bare_git.DeleteRef(name, id) 819 self.bare_git.DeleteRef(name, ref_id)
822 820
823 def GetUploadableBranches(self, selected_branch=None): 821 def GetUploadableBranches(self, selected_branch=None):
824 """List any branches which can be uploaded for review. 822 """List any branches which can be uploaded for review.
@@ -826,15 +824,15 @@ class Project(object):
826 heads = {} 824 heads = {}
827 pubed = {} 825 pubed = {}
828 826
829 for name, id in self._allrefs.iteritems(): 827 for name, ref_id in self._allrefs.iteritems():
830 if name.startswith(R_HEADS): 828 if name.startswith(R_HEADS):
831 heads[name[len(R_HEADS):]] = id 829 heads[name[len(R_HEADS):]] = ref_id
832 elif name.startswith(R_PUB): 830 elif name.startswith(R_PUB):
833 pubed[name[len(R_PUB):]] = id 831 pubed[name[len(R_PUB):]] = ref_id
834 832
835 ready = [] 833 ready = []
836 for branch, id in heads.iteritems(): 834 for branch, ref_id in heads.iteritems():
837 if branch in pubed and pubed[branch] == id: 835 if branch in pubed and pubed[branch] == ref_id:
838 continue 836 continue
839 if selected_branch and branch != selected_branch: 837 if selected_branch and branch != selected_branch:
840 continue 838 continue
@@ -978,18 +976,18 @@ class Project(object):
978 self._InitHooks() 976 self._InitHooks()
979 977
980 def _CopyFiles(self): 978 def _CopyFiles(self):
981 for file in self.copyfiles: 979 for copyfile in self.copyfiles:
982 file._Copy() 980 copyfile._Copy()
983 981
984 def GetRevisionId(self, all=None): 982 def GetRevisionId(self, all_refs=None):
985 if self.revisionId: 983 if self.revisionId:
986 return self.revisionId 984 return self.revisionId
987 985
988 rem = self.GetRemote(self.remote.name) 986 rem = self.GetRemote(self.remote.name)
989 rev = rem.ToLocal(self.revisionExpr) 987 rev = rem.ToLocal(self.revisionExpr)
990 988
991 if all is not None and rev in all: 989 if all_refs is not None and rev in all_refs:
992 return all[rev] 990 return all_refs[rev]
993 991
994 try: 992 try:
995 return self.bare_git.rev_parse('--verify', '%s^0' % rev) 993 return self.bare_git.rev_parse('--verify', '%s^0' % rev)
@@ -1002,16 +1000,16 @@ class Project(object):
1002 """Perform only the local IO portion of the sync process. 1000 """Perform only the local IO portion of the sync process.
1003 Network access is not required. 1001 Network access is not required.
1004 """ 1002 """
1005 all = self.bare_ref.all 1003 all_refs = self.bare_ref.all
1006 self.CleanPublishedCache(all) 1004 self.CleanPublishedCache(all_refs)
1007 revid = self.GetRevisionId(all) 1005 revid = self.GetRevisionId(all_refs)
1008 1006
1009 self._InitWorkTree() 1007 self._InitWorkTree()
1010 head = self.work_git.GetHead() 1008 head = self.work_git.GetHead()
1011 if head.startswith(R_HEADS): 1009 if head.startswith(R_HEADS):
1012 branch = head[len(R_HEADS):] 1010 branch = head[len(R_HEADS):]
1013 try: 1011 try:
1014 head = all[head] 1012 head = all_refs[head]
1015 except KeyError: 1013 except KeyError:
1016 head = None 1014 head = None
1017 else: 1015 else:
@@ -1067,7 +1065,7 @@ class Project(object):
1067 return 1065 return
1068 1066
1069 upstream_gain = self._revlist(not_rev(HEAD), revid) 1067 upstream_gain = self._revlist(not_rev(HEAD), revid)
1070 pub = self.WasPublished(branch.name, all) 1068 pub = self.WasPublished(branch.name, all_refs)
1071 if pub: 1069 if pub:
1072 not_merged = self._revlist(not_rev(revid), pub) 1070 not_merged = self._revlist(not_rev(revid), pub)
1073 if not_merged: 1071 if not_merged:
@@ -1190,8 +1188,8 @@ class Project(object):
1190 if head == (R_HEADS + name): 1188 if head == (R_HEADS + name):
1191 return True 1189 return True
1192 1190
1193 all = self.bare_ref.all 1191 all_refs = self.bare_ref.all
1194 if (R_HEADS + name) in all: 1192 if (R_HEADS + name) in all_refs:
1195 return GitCommand(self, 1193 return GitCommand(self,
1196 ['checkout', name, '--'], 1194 ['checkout', name, '--'],
1197 capture_stdout = True, 1195 capture_stdout = True,
@@ -1200,11 +1198,11 @@ class Project(object):
1200 branch = self.GetBranch(name) 1198 branch = self.GetBranch(name)
1201 branch.remote = self.GetRemote(self.remote.name) 1199 branch.remote = self.GetRemote(self.remote.name)
1202 branch.merge = self.revisionExpr 1200 branch.merge = self.revisionExpr
1203 revid = self.GetRevisionId(all) 1201 revid = self.GetRevisionId(all_refs)
1204 1202
1205 if head.startswith(R_HEADS): 1203 if head.startswith(R_HEADS):
1206 try: 1204 try:
1207 head = all[head] 1205 head = all_refs[head]
1208 except KeyError: 1206 except KeyError:
1209 head = None 1207 head = None
1210 1208
@@ -1245,9 +1243,9 @@ class Project(object):
1245 # 1243 #
1246 return True 1244 return True
1247 1245
1248 all = self.bare_ref.all 1246 all_refs = self.bare_ref.all
1249 try: 1247 try:
1250 revid = all[rev] 1248 revid = all_refs[rev]
1251 except KeyError: 1249 except KeyError:
1252 # Branch does not exist in this project 1250 # Branch does not exist in this project
1253 # 1251 #
@@ -1255,7 +1253,7 @@ class Project(object):
1255 1253
1256 if head.startswith(R_HEADS): 1254 if head.startswith(R_HEADS):
1257 try: 1255 try:
1258 head = all[head] 1256 head = all_refs[head]
1259 except KeyError: 1257 except KeyError:
1260 head = None 1258 head = None
1261 1259
@@ -1283,8 +1281,8 @@ class Project(object):
1283 didn't exist. 1281 didn't exist.
1284 """ 1282 """
1285 rev = R_HEADS + name 1283 rev = R_HEADS + name
1286 all = self.bare_ref.all 1284 all_refs = self.bare_ref.all
1287 if rev not in all: 1285 if rev not in all_refs:
1288 # Doesn't exist 1286 # Doesn't exist
1289 return None 1287 return None
1290 1288
@@ -1293,9 +1291,9 @@ class Project(object):
1293 # We can't destroy the branch while we are sitting 1291 # We can't destroy the branch while we are sitting
1294 # on it. Switch to a detached HEAD. 1292 # on it. Switch to a detached HEAD.
1295 # 1293 #
1296 head = all[head] 1294 head = all_refs[head]
1297 1295
1298 revid = self.GetRevisionId(all) 1296 revid = self.GetRevisionId(all_refs)
1299 if head == revid: 1297 if head == revid:
1300 _lwrite(os.path.join(self.worktree, '.git', HEAD), 1298 _lwrite(os.path.join(self.worktree, '.git', HEAD),
1301 '%s\n' % revid) 1299 '%s\n' % revid)
@@ -1412,33 +1410,33 @@ class Project(object):
1412 packed_refs = os.path.join(self.gitdir, 'packed-refs') 1410 packed_refs = os.path.join(self.gitdir, 'packed-refs')
1413 remote = self.GetRemote(name) 1411 remote = self.GetRemote(name)
1414 1412
1415 all = self.bare_ref.all 1413 all_refs = self.bare_ref.all
1416 ids = set(all.values()) 1414 ids = set(all_refs.values())
1417 tmp = set() 1415 tmp = set()
1418 1416
1419 for r, id in GitRefs(ref_dir).all.iteritems(): 1417 for r, ref_id in GitRefs(ref_dir).all.iteritems():
1420 if r not in all: 1418 if r not in all_refs:
1421 if r.startswith(R_TAGS) or remote.WritesTo(r): 1419 if r.startswith(R_TAGS) or remote.WritesTo(r):
1422 all[r] = id 1420 all_refs[r] = ref_id
1423 ids.add(id) 1421 ids.add(ref_id)
1424 continue 1422 continue
1425 1423
1426 if id in ids: 1424 if ref_id in ids:
1427 continue 1425 continue
1428 1426
1429 r = 'refs/_alt/%s' % id 1427 r = 'refs/_alt/%s' % ref_id
1430 all[r] = id 1428 all_refs[r] = ref_id
1431 ids.add(id) 1429 ids.add(ref_id)
1432 tmp.add(r) 1430 tmp.add(r)
1433 1431
1434 ref_names = list(all.keys()) 1432 ref_names = list(all_refs.keys())
1435 ref_names.sort() 1433 ref_names.sort()
1436 1434
1437 tmp_packed = '' 1435 tmp_packed = ''
1438 old_packed = '' 1436 old_packed = ''
1439 1437
1440 for r in ref_names: 1438 for r in ref_names:
1441 line = '%s %s\n' % (all[r], r) 1439 line = '%s %s\n' % (all_refs[r], r)
1442 tmp_packed += line 1440 tmp_packed += line
1443 if r not in tmp: 1441 if r not in tmp:
1444 old_packed += line 1442 old_packed += line
@@ -1477,7 +1475,7 @@ class Project(object):
1477 cmd.append((u'+refs/heads/%s:' % branch) + remote.ToLocal('refs/heads/%s' % branch)) 1475 cmd.append((u'+refs/heads/%s:' % branch) + remote.ToLocal('refs/heads/%s' % branch))
1478 1476
1479 ok = False 1477 ok = False
1480 for i in range(2): 1478 for _i in range(2):
1481 ret = GitCommand(self, cmd, bare=True, ssh_proxy=ssh_proxy).Wait() 1479 ret = GitCommand(self, cmd, bare=True, ssh_proxy=ssh_proxy).Wait()
1482 if ret == 0: 1480 if ret == 0:
1483 ok = True 1481 ok = True
@@ -2034,7 +2032,7 @@ class _Later(object):
2034 self.action() 2032 self.action()
2035 out.nl() 2033 out.nl()
2036 return True 2034 return True
2037 except GitError, e: 2035 except GitError:
2038 out.nl() 2036 out.nl()
2039 return False 2037 return False
2040 2038
@@ -2104,7 +2102,6 @@ class MetaProject(Project):
2104 """A special project housed under .repo. 2102 """A special project housed under .repo.
2105 """ 2103 """
2106 def __init__(self, manifest, name, gitdir, worktree): 2104 def __init__(self, manifest, name, gitdir, worktree):
2107 repodir = manifest.repodir
2108 Project.__init__(self, 2105 Project.__init__(self,
2109 manifest = manifest, 2106 manifest = manifest,
2110 name = name, 2107 name = name,
@@ -2156,12 +2153,12 @@ class MetaProject(Project):
2156 if not self.remote or not self.revisionExpr: 2153 if not self.remote or not self.revisionExpr:
2157 return False 2154 return False
2158 2155
2159 all = self.bare_ref.all 2156 all_refs = self.bare_ref.all
2160 revid = self.GetRevisionId(all) 2157 revid = self.GetRevisionId(all_refs)
2161 head = self.work_git.GetHead() 2158 head = self.work_git.GetHead()
2162 if head.startswith(R_HEADS): 2159 if head.startswith(R_HEADS):
2163 try: 2160 try:
2164 head = all[head] 2161 head = all_refs[head]
2165 except KeyError: 2162 except KeyError:
2166 head = None 2163 head = None
2167 2164
diff --git a/subcmds/branches.py b/subcmds/branches.py
index a4f8d360..81aa5b18 100644
--- a/subcmds/branches.py
+++ b/subcmds/branches.py
@@ -140,12 +140,12 @@ is shown, then the branch appears in all projects.
140 fmt = out.write 140 fmt = out.write
141 paths = [] 141 paths = []
142 if in_cnt < project_cnt - in_cnt: 142 if in_cnt < project_cnt - in_cnt:
143 type = 'in' 143 in_type = 'in'
144 for b in i.projects: 144 for b in i.projects:
145 paths.append(b.project.relpath) 145 paths.append(b.project.relpath)
146 else: 146 else:
147 fmt = out.notinproject 147 fmt = out.notinproject
148 type = 'not in' 148 in_type = 'not in'
149 have = set() 149 have = set()
150 for b in i.projects: 150 for b in i.projects:
151 have.add(b.project) 151 have.add(b.project)
@@ -153,11 +153,11 @@ is shown, then the branch appears in all projects.
153 if not p in have: 153 if not p in have:
154 paths.append(p.relpath) 154 paths.append(p.relpath)
155 155
156 s = ' %s %s' % (type, ', '.join(paths)) 156 s = ' %s %s' % (in_type, ', '.join(paths))
157 if width + 7 + len(s) < 80: 157 if width + 7 + len(s) < 80:
158 fmt(s) 158 fmt(s)
159 else: 159 else:
160 fmt(' %s:' % type) 160 fmt(' %s:' % in_type)
161 for p in paths: 161 for p in paths:
162 out.nl() 162 out.nl()
163 fmt(width*' ' + ' %s' % p) 163 fmt(width*' ' + ' %s' % p)
diff --git a/subcmds/forall.py b/subcmds/forall.py
index 9436f4e5..76a02688 100644
--- a/subcmds/forall.py
+++ b/subcmds/forall.py
@@ -208,7 +208,6 @@ terminal and are not redirected.
208 return self.fd.fileno() 208 return self.fd.fileno()
209 209
210 empty = True 210 empty = True
211 didout = False
212 errbuf = '' 211 errbuf = ''
213 212
214 p.stdin.close() 213 p.stdin.close()
@@ -220,7 +219,7 @@ terminal and are not redirected.
220 fcntl.fcntl(s.fd, fcntl.F_SETFL, flags | os.O_NONBLOCK) 219 fcntl.fcntl(s.fd, fcntl.F_SETFL, flags | os.O_NONBLOCK)
221 220
222 while s_in: 221 while s_in:
223 in_ready, out_ready, err_ready = select.select(s_in, [], []) 222 in_ready, _out_ready, _err_ready = select.select(s_in, [], [])
224 for s in in_ready: 223 for s in in_ready:
225 buf = s.fd.read(4096) 224 buf = s.fd.read(4096)
226 if not buf: 225 if not buf:
@@ -229,9 +228,7 @@ terminal and are not redirected.
229 continue 228 continue
230 229
231 if not opt.verbose: 230 if not opt.verbose:
232 if s.fd == p.stdout: 231 if s.fd != p.stdout:
233 didout = True
234 else:
235 errbuf += buf 232 errbuf += buf
236 continue 233 continue
237 234
diff --git a/subcmds/help.py b/subcmds/help.py
index 0df3c14b..375d04d2 100644
--- a/subcmds/help.py
+++ b/subcmds/help.py
@@ -120,8 +120,8 @@ See 'repo help --all' for a complete list of recognized commands.
120 m = asciidoc_hdr.match(para) 120 m = asciidoc_hdr.match(para)
121 if m: 121 if m:
122 title = m.group(1) 122 title = m.group(1)
123 type = m.group(2) 123 section_type = m.group(2)
124 if type[0] in ('=', '-'): 124 if section_type[0] in ('=', '-'):
125 p = self.heading 125 p = self.heading
126 else: 126 else:
127 def _p(fmt, *args): 127 def _p(fmt, *args):
@@ -131,7 +131,7 @@ See 'repo help --all' for a complete list of recognized commands.
131 131
132 p('%s', title) 132 p('%s', title)
133 self.nl() 133 self.nl()
134 p('%s', ''.ljust(len(title),type[0])) 134 p('%s', ''.ljust(len(title),section_type[0]))
135 self.nl() 135 self.nl()
136 continue 136 continue
137 137
diff --git a/subcmds/init.py b/subcmds/init.py
index 9a9317e4..007667e2 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -213,8 +213,6 @@ to update the working directory files.
213 sys.exit(1) 213 sys.exit(1)
214 214
215 def _Prompt(self, prompt, value): 215 def _Prompt(self, prompt, value):
216 mp = self.manifest.manifestProject
217
218 sys.stdout.write('%-10s [%s]: ' % (prompt, value)) 216 sys.stdout.write('%-10s [%s]: ' % (prompt, value))
219 a = sys.stdin.readline().strip() 217 a = sys.stdin.readline().strip()
220 if a == '': 218 if a == '':
@@ -332,9 +330,9 @@ to update the working directory files.
332 self._ConfigureDepth(opt) 330 self._ConfigureDepth(opt)
333 331
334 if self.manifest.IsMirror: 332 if self.manifest.IsMirror:
335 type = 'mirror ' 333 init_type = 'mirror '
336 else: 334 else:
337 type = '' 335 init_type = ''
338 336
339 print '' 337 print ''
340 print 'repo %sinitialized in %s' % (type, self.manifest.topdir) 338 print 'repo %sinitialized in %s' % (init_type, self.manifest.topdir)
diff --git a/subcmds/manifest.py b/subcmds/manifest.py
index 43887654..5592a37d 100644
--- a/subcmds/manifest.py
+++ b/subcmds/manifest.py
@@ -35,14 +35,14 @@ in a Git repository for use during future 'repo init' invocations.
35 35
36 @property 36 @property
37 def helpDescription(self): 37 def helpDescription(self):
38 help = self._helpDescription + '\n' 38 helptext = self._helpDescription + '\n'
39 r = os.path.dirname(__file__) 39 r = os.path.dirname(__file__)
40 r = os.path.dirname(r) 40 r = os.path.dirname(r)
41 fd = open(os.path.join(r, 'docs', 'manifest-format.txt')) 41 fd = open(os.path.join(r, 'docs', 'manifest-format.txt'))
42 for line in fd: 42 for line in fd:
43 help += line 43 helptext += line
44 fd.close() 44 fd.close()
45 return help 45 return helptext
46 46
47 def _Options(self, p): 47 def _Options(self, p):
48 p.add_option('-r', '--revision-as-HEAD', 48 p.add_option('-r', '--revision-as-HEAD',
diff --git a/subcmds/overview.py b/subcmds/overview.py
index 96fa93d8..a509bd9a 100644
--- a/subcmds/overview.py
+++ b/subcmds/overview.py
@@ -38,16 +38,16 @@ are displayed.
38 help="Consider only checked out branches") 38 help="Consider only checked out branches")
39 39
40 def Execute(self, opt, args): 40 def Execute(self, opt, args):
41 all = [] 41 all_branches = []
42 for project in self.GetProjects(args): 42 for project in self.GetProjects(args):
43 br = [project.GetUploadableBranch(x) 43 br = [project.GetUploadableBranch(x)
44 for x in project.GetBranches().keys()] 44 for x in project.GetBranches().keys()]
45 br = [x for x in br if x] 45 br = [x for x in br if x]
46 if opt.current_branch: 46 if opt.current_branch:
47 br = [x for x in br if x.name == project.CurrentBranch] 47 br = [x for x in br if x.name == project.CurrentBranch]
48 all.extend(br) 48 all_branches.extend(br)
49 49
50 if not all: 50 if not all_branches:
51 return 51 return
52 52
53 class Report(Coloring): 53 class Report(Coloring):
@@ -55,13 +55,13 @@ are displayed.
55 Coloring.__init__(self, config, 'status') 55 Coloring.__init__(self, config, 'status')
56 self.project = self.printer('header', attr='bold') 56 self.project = self.printer('header', attr='bold')
57 57
58 out = Report(all[0].project.config) 58 out = Report(all_branches[0].project.config)
59 out.project('Projects Overview') 59 out.project('Projects Overview')
60 out.nl() 60 out.nl()
61 61
62 project = None 62 project = None
63 63
64 for branch in all: 64 for branch in all_branches:
65 if project != branch.project: 65 if project != branch.project:
66 project = branch.project 66 project = branch.project
67 out.nl() 67 out.nl()
diff --git a/subcmds/prune.py b/subcmds/prune.py
index f412bd48..c50a5507 100644
--- a/subcmds/prune.py
+++ b/subcmds/prune.py
@@ -24,11 +24,11 @@ class Prune(PagedCommand):
24""" 24"""
25 25
26 def Execute(self, opt, args): 26 def Execute(self, opt, args):
27 all = [] 27 all_branches = []
28 for project in self.GetProjects(args): 28 for project in self.GetProjects(args):
29 all.extend(project.PruneHeads()) 29 all_branches.extend(project.PruneHeads())
30 30
31 if not all: 31 if not all_branches:
32 return 32 return
33 33
34 class Report(Coloring): 34 class Report(Coloring):
@@ -36,13 +36,13 @@ class Prune(PagedCommand):
36 Coloring.__init__(self, config, 'status') 36 Coloring.__init__(self, config, 'status')
37 self.project = self.printer('header', attr='bold') 37 self.project = self.printer('header', attr='bold')
38 38
39 out = Report(all[0].project.config) 39 out = Report(all_branches[0].project.config)
40 out.project('Pending Branches') 40 out.project('Pending Branches')
41 out.nl() 41 out.nl()
42 42
43 project = None 43 project = None
44 44
45 for branch in all: 45 for branch in all_branches:
46 if project != branch.project: 46 if project != branch.project:
47 project = branch.project 47 project = branch.project
48 out.nl() 48 out.nl()
diff --git a/subcmds/rebase.py b/subcmds/rebase.py
index 2c1752d7..a8d58cdb 100644
--- a/subcmds/rebase.py
+++ b/subcmds/rebase.py
@@ -55,14 +55,14 @@ branch but need to incorporate new upstream changes "underneath" them.
55 help='Stash local modifications before starting') 55 help='Stash local modifications before starting')
56 56
57 def Execute(self, opt, args): 57 def Execute(self, opt, args):
58 all = self.GetProjects(args) 58 all_projects = self.GetProjects(args)
59 one_project = len(all) == 1 59 one_project = len(all_projects) == 1
60 60
61 if opt.interactive and not one_project: 61 if opt.interactive and not one_project:
62 print >>sys.stderr, 'error: interactive rebase not supported with multiple projects' 62 print >>sys.stderr, 'error: interactive rebase not supported with multiple projects'
63 return -1 63 return -1
64 64
65 for project in all: 65 for project in all_projects:
66 cb = project.CurrentBranch 66 cb = project.CurrentBranch
67 if not cb: 67 if not cb:
68 if one_project: 68 if one_project:
diff --git a/subcmds/stage.py b/subcmds/stage.py
index 4c221dba..2ec48069 100644
--- a/subcmds/stage.py
+++ b/subcmds/stage.py
@@ -48,8 +48,8 @@ The '%prog' command stages files to prepare the next commit.
48 self.Usage() 48 self.Usage()
49 49
50 def _Interactive(self, opt, args): 50 def _Interactive(self, opt, args):
51 all = filter(lambda x: x.IsDirty(), self.GetProjects(args)) 51 all_projects = filter(lambda x: x.IsDirty(), self.GetProjects(args))
52 if not all: 52 if not all_projects:
53 print >>sys.stderr,'no projects have uncommitted modifications' 53 print >>sys.stderr,'no projects have uncommitted modifications'
54 return 54 return
55 55
@@ -58,8 +58,8 @@ The '%prog' command stages files to prepare the next commit.
58 out.header(' %s', 'project') 58 out.header(' %s', 'project')
59 out.nl() 59 out.nl()
60 60
61 for i in xrange(0, len(all)): 61 for i in xrange(0, len(all_projects)):
62 p = all[i] 62 p = all_projects[i]
63 out.write('%3d: %s', i + 1, p.relpath + '/') 63 out.write('%3d: %s', i + 1, p.relpath + '/')
64 out.nl() 64 out.nl()
65 out.nl() 65 out.nl()
@@ -93,11 +93,11 @@ The '%prog' command stages files to prepare the next commit.
93 if a_index is not None: 93 if a_index is not None:
94 if a_index == 0: 94 if a_index == 0:
95 break 95 break
96 if 0 < a_index and a_index <= len(all): 96 if 0 < a_index and a_index <= len(all_projects):
97 _AddI(all[a_index - 1]) 97 _AddI(all_projects[a_index - 1])
98 continue 98 continue
99 99
100 p = filter(lambda x: x.name == a or x.relpath == a, all) 100 p = filter(lambda x: x.name == a or x.relpath == a, all_projects)
101 if len(p) == 1: 101 if len(p) == 1:
102 _AddI(p[0]) 102 _AddI(p[0])
103 continue 103 continue
diff --git a/subcmds/start.py b/subcmds/start.py
index 00885076..be645314 100644
--- a/subcmds/start.py
+++ b/subcmds/start.py
@@ -52,10 +52,10 @@ revision specified in the manifest.
52 print >>sys.stderr, "error: at least one project must be specified" 52 print >>sys.stderr, "error: at least one project must be specified"
53 sys.exit(1) 53 sys.exit(1)
54 54
55 all = self.GetProjects(projects) 55 all_projects = self.GetProjects(projects)
56 56
57 pm = Progress('Starting %s' % nb, len(all)) 57 pm = Progress('Starting %s' % nb, len(all_projects))
58 for project in all: 58 for project in all_projects:
59 pm.update() 59 pm.update()
60 # If the current revision is a specific SHA1 then we can't push back 60 # If the current revision is a specific SHA1 then we can't push back
61 # to it so substitute the manifest default revision instead. 61 # to it so substitute the manifest default revision instead.
diff --git a/subcmds/status.py b/subcmds/status.py
index 75d68ebc..7611621e 100644
--- a/subcmds/status.py
+++ b/subcmds/status.py
@@ -98,18 +98,18 @@ the following meanings:
98 sem.release() 98 sem.release()
99 99
100 def Execute(self, opt, args): 100 def Execute(self, opt, args):
101 all = self.GetProjects(args) 101 all_projects = self.GetProjects(args)
102 counter = itertools.count() 102 counter = itertools.count()
103 103
104 if opt.jobs == 1: 104 if opt.jobs == 1:
105 for project in all: 105 for project in all_projects:
106 state = project.PrintWorkTreeStatus() 106 state = project.PrintWorkTreeStatus()
107 if state == 'CLEAN': 107 if state == 'CLEAN':
108 counter.next() 108 counter.next()
109 else: 109 else:
110 sem = _threading.Semaphore(opt.jobs) 110 sem = _threading.Semaphore(opt.jobs)
111 threads_and_output = [] 111 threads_and_output = []
112 for project in all: 112 for project in all_projects:
113 sem.acquire() 113 sem.acquire()
114 114
115 class BufList(StringIO.StringIO): 115 class BufList(StringIO.StringIO):
@@ -128,5 +128,5 @@ the following meanings:
128 t.join() 128 t.join()
129 output.dump(sys.stdout) 129 output.dump(sys.stdout)
130 output.close() 130 output.close()
131 if len(all) == counter.next(): 131 if len(all_projects) == counter.next():
132 print 'nothing to commit (working directory clean)' 132 print 'nothing to commit (working directory clean)'
diff --git a/subcmds/sync.py b/subcmds/sync.py
index b84d169f..1b716351 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -316,8 +316,7 @@ later is required to fix a server side protocol bug.
316 if not path: 316 if not path:
317 continue 317 continue
318 if path not in new_project_paths: 318 if path not in new_project_paths:
319 """If the path has already been deleted, we don't need to do it 319 # If the path has already been deleted, we don't need to do it
320 """
321 if os.path.exists(self.manifest.topdir + '/' + path): 320 if os.path.exists(self.manifest.topdir + '/' + path):
322 project = Project( 321 project = Project(
323 manifest = self.manifest, 322 manifest = self.manifest,
@@ -495,16 +494,16 @@ uncommitted changes are present' % project.relpath
495 self.manifest._Unload() 494 self.manifest._Unload()
496 if opt.jobs is None: 495 if opt.jobs is None:
497 self.jobs = self.manifest.default.sync_j 496 self.jobs = self.manifest.default.sync_j
498 all = self.GetProjects(args, missing_ok=True) 497 all_projects = self.GetProjects(args, missing_ok=True)
499 498
500 if not opt.local_only: 499 if not opt.local_only:
501 to_fetch = [] 500 to_fetch = []
502 now = time.time() 501 now = time.time()
503 if (24 * 60 * 60) <= (now - rp.LastFetch): 502 if (24 * 60 * 60) <= (now - rp.LastFetch):
504 to_fetch.append(rp) 503 to_fetch.append(rp)
505 to_fetch.extend(all) 504 to_fetch.extend(all_projects)
506 505
507 fetched = self._Fetch(to_fetch, opt) 506 self._Fetch(to_fetch, opt)
508 _PostRepoFetch(rp, opt.no_repo_verify) 507 _PostRepoFetch(rp, opt.no_repo_verify)
509 if opt.network_only: 508 if opt.network_only:
510 # bail out now; the rest touches the working tree 509 # bail out now; the rest touches the working tree
@@ -519,8 +518,8 @@ uncommitted changes are present' % project.relpath
519 518
520 syncbuf = SyncBuffer(mp.config, 519 syncbuf = SyncBuffer(mp.config,
521 detach_head = opt.detach_head) 520 detach_head = opt.detach_head)
522 pm = Progress('Syncing work tree', len(all)) 521 pm = Progress('Syncing work tree', len(all_projects))
523 for project in all: 522 for project in all_projects:
524 pm.update() 523 pm.update()
525 if project.worktree: 524 if project.worktree:
526 project.Sync_LocalHalf(syncbuf) 525 project.Sync_LocalHalf(syncbuf)
diff --git a/subcmds/upload.py b/subcmds/upload.py
index c9312973..685e3420 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -40,8 +40,8 @@ def _die(fmt, *args):
40 40
41def _SplitEmails(values): 41def _SplitEmails(values):
42 result = [] 42 result = []
43 for str in values: 43 for value in values:
44 result.extend([s.strip() for s in str.split(',')]) 44 result.extend([s.strip() for s in value.split(',')])
45 return result 45 return result
46 46
47class Upload(InteractiveCommand): 47class Upload(InteractiveCommand):
@@ -174,15 +174,15 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
174 174
175 if answer is None: 175 if answer is None:
176 date = branch.date 176 date = branch.date
177 list = branch.commits 177 commit_list = branch.commits
178 178
179 print 'Upload project %s/ to remote branch %s:' % (project.relpath, project.revisionExpr) 179 print 'Upload project %s/ to remote branch %s:' % (project.relpath, project.revisionExpr)
180 print ' branch %s (%2d commit%s, %s):' % ( 180 print ' branch %s (%2d commit%s, %s):' % (
181 name, 181 name,
182 len(list), 182 len(commit_list),
183 len(list) != 1 and 's' or '', 183 len(commit_list) != 1 and 's' or '',
184 date) 184 date)
185 for commit in list: 185 for commit in commit_list:
186 print ' %s' % commit 186 print ' %s' % commit
187 187
188 sys.stdout.write('to %s (y/N)? ' % remote.review) 188 sys.stdout.write('to %s (y/N)? ' % remote.review)
@@ -212,17 +212,17 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
212 for branch in avail: 212 for branch in avail:
213 name = branch.name 213 name = branch.name
214 date = branch.date 214 date = branch.date
215 list = branch.commits 215 commit_list = branch.commits
216 216
217 if b: 217 if b:
218 script.append('#') 218 script.append('#')
219 script.append('# branch %s (%2d commit%s, %s) to remote branch %s:' % ( 219 script.append('# branch %s (%2d commit%s, %s) to remote branch %s:' % (
220 name, 220 name,
221 len(list), 221 len(commit_list),
222 len(list) != 1 and 's' or '', 222 len(commit_list) != 1 and 's' or '',
223 date, 223 date,
224 project.revisionExpr)) 224 project.revisionExpr))
225 for commit in list: 225 for commit in commit_list:
226 script.append('# %s' % commit) 226 script.append('# %s' % commit)
227 b[name] = branch 227 b[name] = branch
228 228