bzr switch has moved one of my files to .THIS and wants to add it to the branch

Bug #355964 reported by Mary Gardiner
2
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

Scenario:

/branch/checkout is a checkout of a remote branch
/branch/author-writeup is a branch of /branch/checkout containing a directory "Reports/Experimental Proposals/Author sentiment characteristics" that isn't in checkout. ("Reports/Experimental Proposals" is)
"Reports/Experimental Proposals/Author sentiment characteristics" contains one versioned file, proposal.tex, and a bunch of non-versioned LaTeX droppings (proposal.log, proposal.aux and a few others) that .bzrignore knows about.

I have a lightweight-checkout /working-dir that I use to work in. It is a checkout of /branch/author-writeup presently.

I decide to work on a different document.

$ bzr branch /branch/checkout /branch/gamon-sentiment-results
$ bzr switch /branch/gamon-sentiment-results (recall, working directory here is /working)

I then get this error:

Conflict: can't delete Reports/Experimental Proposals/Author sentiment characteristics because it is not empty. Not deleting.
Conflict because Reports/Experimental Proposals/Author sentiment characteristics is not versioned, but has versioned children. Versioned directory.
Contents conflict in Reports/Experimental Proposals/Author sentiment characteristics/proposal.tex
Updated to revision [NUM]
Switched to branch: /branch/gamon-sentiment-results/

I then edit a file without resolving the conflict (I think I didn't notice them): Bibliography/sentiment.bib

$ bzr ci
bzr: ERROR: Conflicts detected in working tree. Use "bzr conflicts" to list, "bzr resolve FILE" to resolve.

$ bzr st
added:
  Reports/Experimental Proposals/Author sentiment characteristics/
  Reports/Experimental Proposals/Author sentiment characteristics/proposal.tex.THIS
modified:
  Bibliography/sentiment.bib
unknown:
  Reports/Experimental Proposals/Author sentiment characteristics/proposal.tex.BASE
conflicts:
  Conflict: can't delete Reports/Experimental Proposals/Author sentiment characteristics because it is not empty. Not deleting.
  Conflict because Reports/Experimental Proposals/Author sentiment characteristics is not versioned, but has versioned children. Versioned directory.
  Contents conflict in Reports/Experimental Proposals/Author sentiment characteristics/proposal.tex

I have no idea what has happened here, but there seem to be several problems:

1. "Reports/Experimental Proposals/Author sentiment characteristics/proposal.tex.THIS" is a pending add when it's actually a file Bazaar created.
2. "Reports/Experimental Proposals/Author sentiment characteristics/proposal.tex" no longer exists in /working, and yet a contents conflict is reported
3. "Reports/Experimental Proposals/Author sentiment characteristics/proposal.tex.BASE" isn't a file that Bazaar shouldn't recognise.

Revision history for this message
Mary Gardiner (puzzlement) wrote :

The relevant parts of ~/.bzr.log do not appear informative, but here they are.

Revision history for this message
Andrew Bennetts (spiv) wrote :

1 & 2. I suspect that when the conflict happened during the merge, bzr did the equivalent of "bzr mv proposal.tex proposal.tex.THIS". I don't think bzr should do that, it's just confusing.

3. I think this is intentional, so that conflict files are extra visible in "bzr status" output. Usually when you do "bzr resolve foo" any foo.BASE/THIS/OTHER files will be automatically deleted. Again, I'm not sure that describing conflict dropping as "unknown" is a good idea, but it doesn't seem unreasonable to me either. In combination with 1 & 2 it makes the situation look even worse though, because a single conflict has caused several different types of changes.

Revision history for this message
Mary Gardiner (puzzlement) wrote :

Since it's probably relevant, I apparently didn't commit proposal.tex to /branch/author-writeup before the fateful bzr switch to /branch/gamon-sentiment-results

diff "Reports/Experimental Proposals/Author sentiment characteristics/proposal.tex.THIS" "Reports/Experimental Proposals/Author sentiment characteristics/proposal.tex.BASE"
5d4
< \author{Mary Gardiner}

Revision history for this message
Mary Gardiner (puzzlement) wrote :

"... a single conflict has caused several different types of changes."

And each of these must be resolved separately. I would have wasted far less time here if Bazaar had eaten my working directory alive rather than move pieces of it around unpredictably.

Revision history for this message
Andrew Bennetts (spiv) wrote :

Oh, apparently the goal here was to simply switch a lightweight checkout (which didn't have any uncommitted changes)? The original tree/branch had proposal.tex (in a directory), and the target branch doesn't have that file or the directory, AIUI. If so, it's pretty that bad that bzr has given a bunch of conflicts and other noise rather than just deleting the directory and file as desired.

Revision history for this message
Mary Gardiner (puzzlement) wrote :

Bazaar will never delete the directory as desired, because LaTeX leaves .aux and .log files behind it and Bazaar won't delete non-versioned files.

However, I think the directory did in fact have uncommited changes (although I didn't intend this, I just forgot to run "bzr st" before "bzr switch"). I'd have preferred switch refuse to run than have this happen though.

Revision history for this message
Andrew Bennetts (spiv) wrote : Re: [Bug 355964] Re: bzr switch has moved one of my files to .THIS and wants to add it to the branch

> However, I think the directory did in fact have uncommited changes
> (although I didn't intend this, I just forgot to run "bzr st" before
> "bzr switch"). I'd have preferred switch refuse to run than have this
> happen though.

It is a feature that switch will work when there are uncommitted changes.
The uncommitted changes will be preserved in the resulting working tree.
I've personally found this useful, not merely thought it sounded like a neat
idea :)

What sucks is if there are conflicts then you end up with a mess that is
hard to undo. i.e. the sequence of "bzr switch foo" / oops I didn't want to
switch yet / "bzr switch old" is intuitive and fine when there are no
conflicts. So perhaps a good feature would be if "bzr switch" first checked
there will be no conflicts before actually changing the tree, with a --force
to override?

Or I guess a reliable way to undo bad switch/merge/update would do, i.e. get
back the original tree with the same uncommitted changes as before the
merge, with no conflict markers or other noise. In theory all the necessary
information should be there.

Vincent Ladeuil (vila)
Changed in bzr:
status: New → Confirmed
tags: added: conflicts
Martin Pool (mbp)
Changed in bzr:
importance: Undecided → Medium
Jelmer Vernooij (jelmer)
tags: added: switch
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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