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
1=== modified file 'commands.py'
2--- commands.py 2010-07-13 06:12:49 +0000
3+++ commands.py 2011-07-12 23:21:06 +0000
4@@ -128,6 +128,7 @@
5 finally:
6 f.close()
7
8+ran_for = [] # not thread safe!!
9 class cmd_externals_command(Command):
10 """Run some command(s) for this and external branches.
11
12@@ -159,9 +160,12 @@
13 global _main_base
14 if _main_base is None:
15 _main_base = branch.base
16-
17+
18+ root = None
19+ if tree is not None:
20+ root=tree.basedir
21 ex = externals.Externals(branch, branch.last_revision(),
22- root=tree.basedir)
23+ root=root)
24 if ex.read_config():
25 # run ecmd command in each externals for multilevel
26 ecmd = ['ecmd']
27@@ -172,6 +176,9 @@
28 ex.adjust_verbosity(ecmd)
29
30 for location, rel_path, revision in ex.branch_iterator(): #@UnusedVariable
31+ if location in ran_for:
32+ continue # don't recurse infinitely on ecmd revert
33+ ran_for.append(location)
34 os.chdir(os.path.join(ex.cwd, rel_path))
35 run_bzr_catch_user_errors(ecmd + ['--'] + command_list)
36

Subscribers

People subscribed via source and target branches