Merge lp:~florian-rathgeber/bzr-externals/fix-deprecated-split-lp-911999 into lp:bzr-externals

Proposed by Florian Rathgeber on 2012-01-04
Status: Merged
Merged at revision: 49
Proposed branch: lp:~florian-rathgeber/bzr-externals/fix-deprecated-split-lp-911999
Merge into: lp:bzr-externals
Diff against target: 24 lines (+4/-3)
1 file modified (+4/-3)
To merge this branch: bzr merge lp:~florian-rathgeber/bzr-externals/fix-deprecated-split-lp-911999
Reviewer Review Type Date Requested Status
Eugene Tarasenko 2012-01-04 Needs Fixing on 2012-01-10
Review via email:

Description of the change

The 'shlex_split_unicode' method in 'bzrlib.commands' used in bzr-externals is deprecated as of bzr 2.2.0 and has been removed in the recent development version of bzr, causing the plugin to crash with:

  bzr: ERROR: exceptions.ImportError: cannot import name shlex_split_unicode

This is a simple fix: replace 'shlex_split_unicode' with 'cmdline.split' (also from 'bzrlib.commands').

To post a comment you must log in.
Eugene Tarasenko (etarasenko) wrote :
Download full text (5.0 KiB)

$ bzr init main
Created a standalone tree (format: 2a)
$ bzr init sub1
Created a standalone tree (format: 2a)
$ cd main/
$ bzr eadd ../sub1 sub1
Add external branch ../sub1 sub1
Branched 0 revision(s).
adding .bzrignore
adding .bzrmeta
adding .bzrmeta/externals
adding .bzrmeta/externals-snapshot

$ bzr ci -m "Add sub1"
Committing to: /home/etarasenko/projects/bzr-externals/main/
added .bzrignore
added .bzrmeta
added .bzrmeta/externals
added .bzrmeta/externals-snapshot
bzr: ERROR: bzrlib.errors.IllegalUseOfScopeReplacer: ScopeReplacer object 'cmdline' was used incorrectly: Object already cleaned up, did you assign it to another variable?: _factory

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 946, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 1150, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 699, in run_argv_aliases
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 721, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 135, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 3316, in run
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 217, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 209, in commit
    result = WorkingTree.commit(self, message, revprops, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 217, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 210, in commit
    *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 289, in commit
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 131, in run
    self.cleanups, self.func, self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 462, in _commit
    self.branch.set_last_revision_info(new_revno, self.rev_id)
  File "/usr/lib/python2.7/dist-packages/bzrlib/", line 217, in w...


review: Needs Fixing
50. By Florian Rathgeber on 2012-01-20

Directly import split from bzrlib.cmdline to properly work with lazy_import.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file ''
2--- 2010-07-13 06:12:49 +0000
3+++ 2012-01-20 00:22:24 +0000
4@@ -18,7 +18,8 @@
6 from bzrlib.urlutils import join, local_path_from_url
7 from bzrlib.osutils import check_legal_path, getcwd, get_user_encoding, isdir, isfile, pathjoin, relpath
8-from bzrlib.commands import run_bzr_catch_user_errors, shlex_split_unicode
9+from bzrlib.commands import run_bzr_catch_user_errors
10+from bzrlib.cmdline import split
11 from bzrlib.trace import is_quiet, is_verbose, note, warning
13 CONFIG_PATH = '.bzrmeta/externals'
14@@ -45,9 +46,9 @@
15 lines = text.splitlines()
16 for line in lines:
17 if len(line.strip()) > 0 and not line.startswith('#'):
18- # function shlex.split not support windows path separator '\'
19+ # function cmdline.split does not support windows path separator '\'
20 line = line.decode('utf-8').replace('\\', '/')
21- arg = shlex_split_unicode(line)
22+ arg = split(line)
23 if arg not in self.config:
24 self.config.append(arg)


People subscribed via source and target branches