Heavy checkouts don't inherit nick

Bug #148030 reported by Matthew Fuller
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
Unassigned

Bug Description

When creating a checkout, you're creating a working tree for a branch. You shouldn't get a new nick. Lightweight checkouts work properly, but heavy don't:

#!/bin/sh
bzr="/usr/local/bin/bzr --no-plugins --no-aliases"

# Initial branch
${bzr} init A
(
    cd A ;
    touch a ;
    ${bzr} add --quiet;
    ${bzr} ci --quiet -m 'add A'
)

# Make heavy and light checkouts
${bzr} checkout --quiet A heavy
${bzr} checkout --quiet --lightweight A light

# Show nicks
for i in A heavy light; do
    nick=`(cd ${i} && bzr nick)`
    printf "%6s %s\n" ${i} ${nick}
done

Revision history for this message
John A Meinel (jameinel) wrote :

This "works" for lightweight because the nick is based on the branch path. Lightweight checkouts don't have another branch, and thus the only nick they can have is from the source.
Heavy checkouts have a local branch, and thus are defaulting to use it.

This could be fixed with just a check in Branch._get_nick/_set_nick to see if they are bound to another branch first.

I'm a little hesitant, because the way it is written requires actually connecting to the remote branch.
And Branch.get_master_branch() doesn't cache the master branch, so it is another full round trip (with another SSH connection opened, etc).

Further, what do you do if there *is* something set in the local branch.conf file? Just ignore it when you are bound and then use it when you are not?

Anyway, it can be argued that this is a feature, and not a bug. Since you did name the checkout something locally. But I can say that I have no use for this feature. (I always name my checkouts the same as the upstream).

Actually, I take that back, my repository sometimes looks like:

repo/dev/0.7

And my checkout becomes

work/dev-0.7/

So that when I commit I get the full "dev-0.7" rather than just "0.7".

Anyway, I would live either way, this should probably become a list discussion.

Changed in bzr:
importance: Undecided → Medium
status: New → Triaged
Martin Pool (mbp)
Changed in bzr:
status: Triaged → Confirmed
Jelmer Vernooij (jelmer)
tags: added: bound-branch nick
Jelmer Vernooij (jelmer)
Changed in bzr:
importance: Medium → High
Revision history for this message
Martin Packman (gz) wrote :

This was fixed as part of bug 230903 in bzr 1.9 as can be seen by the current script output:

Created a standalone tree (format: 2a)
     A A
 heavy A
 light A

However the behaviour is problematic for heavy checkouts of remote branches, see bug 882541 description.

Changed in bzr:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.