externals-add does not work with colocated branches

Bug #932473 reported by Yaroslav Sokolov on 2012-02-15
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar Externals plugin
Undecided
Alexander Belchenko

Bug Description

after trying to execute
  bzr externals-add
in a colocated branch the following error appears:
bzr: ERROR: No such file: u'<project root>/.bzrignore'

Appears in bzr 2.4.2 for Windows. Tested Externals versions: 1.3.3, 1.3.2

PS: manually creating empty .bzrignore does not fix the problem - the same problem with .bzrmeta/externals and .bzrmeta/externals-snapshot

PPS: manually creating all the missing files: .bzrignore, .bzrmeta/externals, .bzrmeta/externals-snapshot makes no sense - these files are not updated by the plugin.

Best regards
Yaroslav Sokolov

Related branches

Yaroslav Sokolov пишет:
> Public bug reported:
>
> after trying to execute
> bzr externals-add
> in a colocated branch the following error appears:
> bzr: ERROR: No such file: u'<project root>/.bzrignore'
>
> Appears in bzr 2.4.2 for Windows. Tested Externals versions: 1.3.3,
> 1.3.2
>
> PS: manually creating empty .bzrignore does not fix the problem - the
> same problem with .bzrmeta/externals and .bzrmeta/externals-snapshot
>
> PPS: manually creating all the missing files: .bzrignore,
> .bzrmeta/externals, .bzrmeta/externals-snapshot makes no sense - these
> files are not updated by the plugin.

Actually those files ARE updated by the plugin, because externals-add
wants to record what it adds, and ignore.

I think manually creating all those files should be a possible
workaround, but the bug is still there: externals-add should cope with
the absence of the required files and create them when needed.

Also, looking at your reproduction steps it's not clear for me why do
you think that colocated branch is special there. As I can see you
just have the branch without above mentioned service files, and you
should get the same error with your trunk in your example.

Also, please, attach to the bug report part of your .bzr.log
corresponding to this error.

Yaroslav Sokolov (yarick123) wrote :

Alexander Belchenko (bialix) wrote:
...
Also, looking at your reproduction steps it's not clear for me why do you think that colocated branch is special there.

Yarick123> The cause is that I do not get these errors if I work with normal not colocated branches.

Alexander Belchenko (bialix) wrote:
...
As I can see you just have the branch without above mentioned service files, and you should get the same error with your trunk in your example.

Yarick123> Actually, for trunk it works perfectly:

D:\bzr_test2\trunk>bzr externals-add ../external_module external_module
Add external branch ../external_module external_module
Branched 1 revision(s).
adding .bzrignore
adding .bzrmeta
adding .bzrmeta/externals
adding .bzrmeta/externals-snapshot

D:\bzr_test2\trunk>

Alexander Belchenko (bialix) wrote:

Also, please, attach to the bug report part of your .bzr.log corresponding to this error.

Yarick123> I attach .bzr.log and whole listing of the commands and their output

Yaroslav Sokolov (yarick123) wrote :
Alexander Belchenko (bialix) wrote :

Wed 2012-02-15 20:05:17 +0100
0.125 bazaar version: 2.4.2
0.125 bzr arguments: [u'externals-add', u'../external_module', u'external_module']
0.156 looking for plugins in E:/Docs_And_Setts/32/ya/Application Data/bazaar/2.0/plugins
0.156 looking for plugins in E:/Progs/Devel/Bazaar/plugins
0.203 encoding stdout as sys.stdout encoding 'cp866'
[ 3168] 2012-02-15 20:05:17.953 INFO: Add external branch ../external_module external_module
0.250 bazaar version: 2.4.2
0.250 bzr arguments: [u'branch', u'../external_module', u'external_module']
0.250 encoding stdout as sys.stdout encoding 'cp866'
0.265 opening working tree 'D:/bzr_test2/external_module'
0.281 opening working tree 'D:/bzr_test2/external_module'
0.328 Using fetch logic to copy between CHKInventoryRepository('file:///D:/bzr_test2/.bzr/repository/')(RepositoryFormat2a()) and CHKInventoryRepository('file:///D:/bzr_test2/.bzr/repository/')(RepositoryFormat2a())
0.328 fetching: <SearchResult search:(set(['yarick@iguana32-20120215190319-v5z6pv887lmhaylp']), set(['null:', 'yarick@iguana32-20120215190319-v5z6pv887lmhaylp']), 0)>
0.328 creating branch <bzrlib.branch.BzrBranchFormat7 object at 0x010BDDB0> in file:///D:/bzr_test2/colo/external_module/
0.390 created new branch BzrBranch7(file:///D:/bzr_test2/colo/external_module/)
0.406 opening working tree 'D:/bzr_test2/colo/external_module'
[ 3168] 2012-02-15 20:05:18.203 INFO: Branched 1 revision(s).
0.500 Transferred: 0kB (0.0kB/s r:0kB w:0kB)
0.515 bazaar version: 2.4.2
0.515 bzr arguments: [u'add', u'.bzrignore', u'.bzrmeta/externals', u'.bzrmeta/externals-snapshot']
0.515 encoding stdout as sys.stdout encoding 'cp866'
0.515 opening working tree 'D:/bzr_test2/colo'
0.562 Transferred: 0kB (0.0kB/s r:0kB w:0kB)
0.562 Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 1257, in run_bzr_catch_user_errors
  File "bzrlib\commands.pyo", line 1150, in run_bzr
  File "bzrlib\commands.pyo", line 699, in run_argv_aliases
  File "bzrlib\commands.pyo", line 721, in run
  File "bzrlib\cleanup.pyo", line 135, in run_simple
  File "bzrlib\cleanup.pyo", line 165, in _do_with_cleanups
  File "bzrlib\builtins.pyo", line 716, in run
  File "bzrlib\mutabletree.pyo", line 51, in tree_write_locked
  File "bzrlib\mutabletree.pyo", line 452, in smart_add
  File "bzrlib\mutabletree.pyo", line 672, in add
  File "bzrlib\osutils.pyo", line 2202, in file_kind
NoSuchFile: No such file: u'D:/bzr_test2/colo/.bzrignore'

Alexander Belchenko (bialix) wrote :

From the traceback: the problem is that bzr-externals runs command `bzr add .bzrignore .bzrmeta/externals .bzrmeta/externals-snapshot` under the hood, and that command failed.

Changed in bzr-externals:
status: New → Confirmed
Alexander Belchenko (bialix) wrote :

@Eugene: looking at the code for externals-add command in commands.py the problem is obvious: line 57:

        root = local_path_from_url(branch.base)

You're using root of the branch itself, but actually you want root to be root directory of the working tree, because for colocated workspace the working tree and branch located in two adjacent folders, see:

colo/ <-- working tree root and usually the place where from the command executed
colo/.bzr/
colo/.bzr/branches/ <-- shared repository with colocated branches
colo/.bzr/branches/trunk <-- the branch root or current colocated tree

So every time you pathjoin(root, somethingelse) you've got wrong path. You have to open workingtree and use its basedir as root.

Alexander Belchenko (bialix) wrote :

@Yaroslav: can you try my patch that should fix this problem? Also you can get it from my branch:
https://code.launchpad.net/~bialix/bzr-externals/bug-932473/

Changed in bzr-externals:
assignee: nobody → Alexander Belchenko (bialix)
Eugene Tarasenko (etarasenko) wrote :

Thank you Alexander.

Changed in bzr-externals:
status: Confirmed → Fix Committed
Yaroslav Sokolov (yarick123) wrote :

@Alexander: Thank you. I have just tested from the main branch lp:bzr-externals. It works!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers