'bzr annotate PATH' after 'bzr update -rX' fails

Bug #551758 reported by GuilhemBichot
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

Grab the branch attached to comment #3: <http://launchpadlibrarian.net/42636794/branch_551758.tar.gz>, and untar it.

$ wget http://launchpadlibrarian.net/42636794/branch_551758.tar.gz
$ tar xzf branch_551758.tar.gz
$ cd branch_551758

Update to r2, and try annotating a file present in r2 (and so in our working tree of r2), but not present in the branch tip:

$ bzr update -r2
+N inno/trx/
+N inno/trx/trx.c
-D inno/trx/
-D inno/trx/trx.c
All changes applied successfully.
Updated to revision 2 of branch /tmp/branch_551758
$ bzr annotate inno/trx/trx.c
bzr: ERROR: The file id "trx.c-20100328163754-yhpyfzy03yeeuclh-1" is not present in the tree <bzrlib.inventory.CHKInventory object at 0x96c8f4c>.

Workaround: specify -rX to annotate to match the revision passed to update -rX:

$ bzr annotate inno/trx/trx.c -r2
1 vasil.d | int a;
2 vasil.d | int b;

Revision history for this message
Martin Pool (mbp) wrote :

Hi Guilhem,

If you want you can use <https://answers.edge.launchpad.net/bzr/+addquestion> which goes into a more question-oriented workflow and lets us then create or link to particular bugs.

bzr blame and bzr update should both work in the way you expected: annotation should tell you about the contents of the file as it existed in that history, and update should give you a working tree looking at revision 2.

I believe the issue with annotate is bug 537442.

The problem with update is surprising to me. Is the branch where this occurs public?

Revision history for this message
GuilhemBichot (guilhem-bichot) wrote :

Hello Martin.
For "annotate", bug 537442 is about "bzr: ERROR: file.f is not versioned" whereas we get "bzr: ERROR: The file id "trx.c-20100328163452-arkhzrgwlj1f761f-1" is not present in the tree <bzrlib.inventory.CHKInventory object at 0xb773d88c>" so I cannot yet be sure that they are duplicate.
For "update", ok I'm attaching the branch to the bug report.
Here is a transcript of my session (bzr 2.1), when I'm chdir'd into the attached branch.

$] bzr annotate -r2 inno/trx/trx.c
bzr: ERROR: The file id "trx.c-20100328163452-arkhzrgwlj1f761f-1" is not present in the tree <bzrlib.inventory.CHKInventory object at 0x182ad90>.
$] bzr branch . ../test -r2
Branched 2 revision(s).
$] bzr annotate ../test/inno/trx/trx.c
1 vasil.d | int a;
2 vasil.d | int b;
$] bzr annotate -r2 ../test/inno/trx/trx.c
1 vasil.d | int a;
2 vasil.d | int b;
$] bzr update -r2
+N inno/trx/
+N inno/trx/trx.c
-D inno/trx/
-D inno/trx/trx.c
All changes applied successfully.
Updated to revision 2 of branch /home/guilhem/branch_551758
$] bzr annotate inno/trx/trx.c
bzr: ERROR: The file id "trx.c-20100328163754-yhpyfzy03yeeuclh-1" is not present in the tree <bzrlib.inventory.CHKInventory object at 0x185ccd0>.
$] bzr annotate -r2 inno/trx/trx.c
1 vasil.d | int a;
2 vasil.d | int b;

Revision history for this message
GuilhemBichot (guilhem-bichot) wrote :
Revision history for this message
Andrew Bennetts (spiv) wrote :

Thanks very much for the exact instructions and data for reproducing.

The error message is certainly unhelpful, so at minimum we should improve that.

Here's something interesting:

$ bzr st -r2
removed:
  inno/trx/
  inno/trx/trx.c
added:
  inno/trx/
  inno/trx/trx.c

So inno/trx/trx.c in revision 2 is a different file to inno/trx/trx.c in the working tree. Here's confirmation:

$ bzr file-id inno/trx/trx.c
trx.c-20100328163452-arkhzrgwlj1f761f-1
$ bzr inventory -r2 --show-ids | grep trx.c
inno/trx/trx.c trx.c-20100328163754-yhpyfzy03yeeuclh-1

So I think there's a few issues with annotate here:

 1) the error doesn't make this cause clear (that you are asking for the annotation of a version of the file that never existed)
 2) there's no obvious way to annotate that deleted file (this is bug 537442, maybe?)
 3) annotate could/should notice that a file with the same path exists, and assume you meant that instead (and emit a warning about the possible confusion). I can't think of a situation where this would be less desirable than the current behaviour, but we could add a --strict or something if necessary.

Finally, as far as I can tell, 'bzr update -r' is working correctly, but there's a separate issue:
 4) annotate apparently still tries to look up the file in the branch's revision, not the working tree's revision.

Here's a workaround:

$ bzr update -r 2
$ bzr annotate inno/trx/trx.c -r2
1 vasil.d | int a;
2 vasil.d | int b;

So I'm going to refocus this bug on a single issue: 'bzr annotate PATH' after 'bzr update -rX' fails.

The 'bzr annotate -rX path' part is, I think, a dupe of bug 537442, which is that 'bzr annotate -rX path' doesn't work if the file at path in the working tree is not versioned in the rX tree. The "deleted & replaced" case isn't much different to just "deleted", although the symptoms are slightly different.

Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Andrew Bennetts (spiv) wrote :

Sorry, a small correction: I meant bug 255687, not 537442.

Andrew Bennetts (spiv)
summary: - "bzr blame -rX" and "bzr update -rX" fail: supported?
+ 'bzr annotate PATH' after 'bzr update -rX' fails
description: updated
tags: added: annotate
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

Remote bug watches

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