diff options
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/__init__.py | 8 | ||||
| -rw-r--r-- | subcmds/abandon.py | 6 | ||||
| -rw-r--r-- | subcmds/branches.py | 12 | ||||
| -rw-r--r-- | subcmds/checkout.py | 6 | ||||
| -rw-r--r-- | subcmds/forall.py | 6 |
5 files changed, 21 insertions, 17 deletions
diff --git a/subcmds/__init__.py b/subcmds/__init__.py index a2286e78..1fac802e 100644 --- a/subcmds/__init__.py +++ b/subcmds/__init__.py | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | import os | 16 | import os |
| 17 | 17 | ||
| 18 | all = {} | 18 | all_commands = {} |
| 19 | 19 | ||
| 20 | my_dir = os.path.dirname(__file__) | 20 | my_dir = os.path.dirname(__file__) |
| 21 | for py in os.listdir(my_dir): | 21 | for py in os.listdir(my_dir): |
| @@ -43,7 +43,7 @@ for py in os.listdir(my_dir): | |||
| 43 | 43 | ||
| 44 | name = name.replace('_', '-') | 44 | name = name.replace('_', '-') |
| 45 | cmd.NAME = name | 45 | cmd.NAME = name |
| 46 | all[name] = cmd | 46 | all_commands[name] = cmd |
| 47 | 47 | ||
| 48 | if 'help' in all: | 48 | if 'help' in all_commands: |
| 49 | all['help'].commands = all | 49 | all_commands['help'].commands = all_commands |
diff --git a/subcmds/abandon.py b/subcmds/abandon.py index 42abb2ff..e17ab2b6 100644 --- a/subcmds/abandon.py +++ b/subcmds/abandon.py | |||
| @@ -42,10 +42,10 @@ It is equivalent to "git branch -D <branchname>". | |||
| 42 | nb = args[0] | 42 | nb = args[0] |
| 43 | err = [] | 43 | err = [] |
| 44 | success = [] | 44 | success = [] |
| 45 | all = self.GetProjects(args[1:]) | 45 | all_projects = self.GetProjects(args[1:]) |
| 46 | 46 | ||
| 47 | pm = Progress('Abandon %s' % nb, len(all)) | 47 | pm = Progress('Abandon %s' % nb, len(all_projects)) |
| 48 | for project in all: | 48 | for project in all_projects: |
| 49 | pm.update() | 49 | pm.update() |
| 50 | 50 | ||
| 51 | status = project.AbandonBranch(nb) | 51 | status = project.AbandonBranch(nb) |
diff --git a/subcmds/branches.py b/subcmds/branches.py index 81aa5b18..a7ba3d6d 100644 --- a/subcmds/branches.py +++ b/subcmds/branches.py | |||
| @@ -93,17 +93,17 @@ is shown, then the branch appears in all projects. | |||
| 93 | def Execute(self, opt, args): | 93 | def Execute(self, opt, args): |
| 94 | projects = self.GetProjects(args) | 94 | projects = self.GetProjects(args) |
| 95 | out = BranchColoring(self.manifest.manifestProject.config) | 95 | out = BranchColoring(self.manifest.manifestProject.config) |
| 96 | all = {} | 96 | all_branches = {} |
| 97 | project_cnt = len(projects) | 97 | project_cnt = len(projects) |
| 98 | 98 | ||
| 99 | for project in projects: | 99 | for project in projects: |
| 100 | for name, b in project.GetBranches().iteritems(): | 100 | for name, b in project.GetBranches().iteritems(): |
| 101 | b.project = project | 101 | b.project = project |
| 102 | if name not in all: | 102 | if name not in all_branches: |
| 103 | all[name] = BranchInfo(name) | 103 | all_branches[name] = BranchInfo(name) |
| 104 | all[name].add(b) | 104 | all_branches[name].add(b) |
| 105 | 105 | ||
| 106 | names = all.keys() | 106 | names = all_branches.keys() |
| 107 | names.sort() | 107 | names.sort() |
| 108 | 108 | ||
| 109 | if not names: | 109 | if not names: |
| @@ -116,7 +116,7 @@ is shown, then the branch appears in all projects. | |||
| 116 | width = len(name) | 116 | width = len(name) |
| 117 | 117 | ||
| 118 | for name in names: | 118 | for name in names: |
| 119 | i = all[name] | 119 | i = all_branches[name] |
| 120 | in_cnt = len(i.projects) | 120 | in_cnt = len(i.projects) |
| 121 | 121 | ||
| 122 | if i.IsCurrent: | 122 | if i.IsCurrent: |
diff --git a/subcmds/checkout.py b/subcmds/checkout.py index 533d20e1..bfbe9921 100644 --- a/subcmds/checkout.py +++ b/subcmds/checkout.py | |||
| @@ -39,10 +39,10 @@ The command is equivalent to: | |||
| 39 | nb = args[0] | 39 | nb = args[0] |
| 40 | err = [] | 40 | err = [] |
| 41 | success = [] | 41 | success = [] |
| 42 | all = self.GetProjects(args[1:]) | 42 | all_projects = self.GetProjects(args[1:]) |
| 43 | 43 | ||
| 44 | pm = Progress('Checkout %s' % nb, len(all)) | 44 | pm = Progress('Checkout %s' % nb, len(all_projects)) |
| 45 | for project in all: | 45 | for project in all_projects: |
| 46 | pm.update() | 46 | pm.update() |
| 47 | 47 | ||
| 48 | status = project.CheckoutBranch(nb) | 48 | status = project.CheckoutBranch(nb) |
diff --git a/subcmds/forall.py b/subcmds/forall.py index 76a02688..2ece95ed 100644 --- a/subcmds/forall.py +++ b/subcmds/forall.py | |||
| @@ -141,12 +141,16 @@ terminal and are not redirected. | |||
| 141 | for cn in cmd[1:]: | 141 | for cn in cmd[1:]: |
| 142 | if not cn.startswith('-'): | 142 | if not cn.startswith('-'): |
| 143 | break | 143 | break |
| 144 | if cn in _CAN_COLOR: | 144 | else: |
| 145 | cn = None | ||
| 146 | # pylint: disable-msg=W0631 | ||
| 147 | if cn and cn in _CAN_COLOR: | ||
| 145 | class ColorCmd(Coloring): | 148 | class ColorCmd(Coloring): |
| 146 | def __init__(self, config, cmd): | 149 | def __init__(self, config, cmd): |
| 147 | Coloring.__init__(self, config, cmd) | 150 | Coloring.__init__(self, config, cmd) |
| 148 | if ColorCmd(self.manifest.manifestProject.config, cn).is_on: | 151 | if ColorCmd(self.manifest.manifestProject.config, cn).is_on: |
| 149 | cmd.insert(cmd.index(cn) + 1, '--color') | 152 | cmd.insert(cmd.index(cn) + 1, '--color') |
| 153 | # pylint: enable-msg=W0631 | ||
| 150 | 154 | ||
| 151 | mirror = self.manifest.IsMirror | 155 | mirror = self.manifest.IsMirror |
| 152 | out = ForallColoring(self.manifest.manifestProject.config) | 156 | out = ForallColoring(self.manifest.manifestProject.config) |
