Merge lp:~amanica/bzr-externals/ecmd_revert_infinite_recursion into lp:bzr-externals

Proposed by Marius Kruger
Status: Merged
Merged at revision: 50
Proposed branch: lp:~amanica/bzr-externals/ecmd_revert_infinite_recursion
Merge into: lp:bzr-externals
Diff against target: 35 lines (+9/-2)
1 file modified
commands.py (+9/-2)
To merge this branch: bzr merge lp:~amanica/bzr-externals/ecmd_revert_infinite_recursion
Reviewer Review Type Date Requested Status
Eugene Tarasenko Pending
Review via email: mp+67768@code.launchpad.net

Description of the change

when doing bzr ecmd revert it goes into an infinite recursion.
Also I've been using ligthweight checkouts and I think half of this patch makes that work.

This is not threadsafe but it works, and I have been using it for a long time.
It may be possible to do this in a better way, but the way we recurse makes it difficult.

To post a comment you must log in.
Revision history for this message
Eugene Tarasenko (etarasenko) wrote :

I can't reproduce this bug, please write steps for repeat and what version bzr, bzr-externals your use?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'commands.py'
--- commands.py 2010-07-13 06:12:49 +0000
+++ commands.py 2011-07-12 23:21:06 +0000
@@ -128,6 +128,7 @@
128 finally:128 finally:
129 f.close()129 f.close()
130130
131ran_for = [] # not thread safe!!
131class cmd_externals_command(Command):132class cmd_externals_command(Command):
132 """Run some command(s) for this and external branches.133 """Run some command(s) for this and external branches.
133134
@@ -159,9 +160,12 @@
159 global _main_base160 global _main_base
160 if _main_base is None:161 if _main_base is None:
161 _main_base = branch.base162 _main_base = branch.base
162 163
164 root = None
165 if tree is not None:
166 root=tree.basedir
163 ex = externals.Externals(branch, branch.last_revision(),167 ex = externals.Externals(branch, branch.last_revision(),
164 root=tree.basedir)168 root=root)
165 if ex.read_config():169 if ex.read_config():
166 # run ecmd command in each externals for multilevel170 # run ecmd command in each externals for multilevel
167 ecmd = ['ecmd']171 ecmd = ['ecmd']
@@ -172,6 +176,9 @@
172 ex.adjust_verbosity(ecmd)176 ex.adjust_verbosity(ecmd)
173177
174 for location, rel_path, revision in ex.branch_iterator(): #@UnusedVariable178 for location, rel_path, revision in ex.branch_iterator(): #@UnusedVariable
179 if location in ran_for:
180 continue # don't recurse infinitely on ecmd revert
181 ran_for.append(location)
175 os.chdir(os.path.join(ex.cwd, rel_path))182 os.chdir(os.path.join(ex.cwd, rel_path))
176 run_bzr_catch_user_errors(ecmd + ['--'] + command_list)183 run_bzr_catch_user_errors(ecmd + ['--'] + command_list)
177184

Subscribers

People subscribed via source and target branches