diff -r-2..-1 for branch with one revision is confusing

Bug #76765 reported by Marius Kruger
2
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Low
Unassigned
Breezy
Triaged
Low
Unassigned

Bug Description

bzr init
echo "test" > someFile.txt
bzr add someFile.txt
bzr commit -m "initial commit"
bzr diff -r-2..-1 #doesn't show changes
bzr diff -r0..-1 #does show changes

This was unexpected and I believe that they should behave the same
if there is currently only one committed revision

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

At the moment, negative numbers are trapped at 1. So if you a slightly longer branch (say 5 revisions) you can do:

bzr log -r -10..-1

And it will print out all 5 revisions.

The impedance mismatch is because 'bzr diff' is showing the difference from X to Y, while log is showing everything from X to Y *inclusive*.

So there is no 'bzr log -r 0' because that isn't a revision. But there is a diff -r 0, because that is the Null revision.

I'm not sure how to reconcile this, but I can agree that it is a little confusing/inconsistent.

Changed in bzr:
importance: Undecided → Low
status: Unconfirmed → Confirmed
Revision history for this message
Aaron Bentley (abentley) wrote : Re: [Bug 76765] diff -r-1 for branch with one revision is broken

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marius Kruger wrote:
> Public bug reported:
>
> bzr init
> echo "test" > someFile.txt
> bzr add someFile.txt
> bzr commit -m "initial commit"
> bzr diff -r-1 #doesn't show changes
> bzr diff -r0 #does show changes
>
> This was unexpected and I believe that they should behave the same
> if there is currently only one committed revision

- -1 represents the basis revision; the last thing you committed.

So if you have not modified the tree since the last commit, "bzr diff -r
- -1" will not show any changes.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFFiuQL0F+nu1YWqI0RArwVAJ0b2HE5lbQaF6RWFOs4OAhN9P0ROgCdHWfE
sZP3/PW70GdsQIyyzKUtA/8=
=SRsX
-----END PGP SIGNATURE-----

Revision history for this message
John A Meinel (jameinel) wrote : Re: diff -r-1 for branch with one revision is broken

Aaron is correct, though you would have the problem I mentioned if you supplied "bzr diff -r-2"

Marius, is that what you were thinking?

Revision history for this message
Marius Kruger (amanica) wrote : Re: [Bug 76765] Re: diff -r-1 for branch with one revision is broken

yes, Aaron you're right, I suspected I might be overlooking something,
but yes John, I actually came upon this problem while trying to do a
bzr diff -r-2..-1 which normally gives me the diff for the previous commit,

but it does not work if you have only one revision.

so the heading sould be:
diff -r-2 for branch with one revision is a little confusing/inconsistent

On 12/21/06, Aaron Bentley <email address hidden> wrote:-----BEGIN PGP
> SIGNED MESSAGE-----
> Hash: SHA1
>
> - -1 represents the basis revision; the last thing you committed.
>
> So if you have not modified the tree since the last commit, "bzr diff -r
> - -1" will not show any changes.
>

On 12/21/06, John A Meinel <email address hidden> wrote:
>
> Aaron is correct, though you would have the problem I mentioned if you
> supplied "bzr diff -r-2"
>
> Marius, is that what you were thinking?
>
> --
> diff -r-1 for branch with one revision is broken
> https://launchpad.net/bugs/76765
>

--

I code therefore I am.

John A Meinel (jameinel)
description: updated
Jelmer Vernooij (jelmer)
tags: added: diff
tags: added: revno
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: added: revspec
removed: check-for-breezy
Changed in brz:
status: New → Triaged
importance: Undecided → Medium
importance: Medium → Low
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.