bzr log -rX shows revision X even if X is not in branch
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Confirmed
|
Medium
|
Unassigned |
Bug Description
We have tens of code branches. If I want to know whether revid X is in branch Y, I do
>cd Y
>bzr log -rX
If this prints the revision, I conclude that X is in this branch. And many other colleagues do the same.
Today we discovered that if our branches are all hosted in a shared repository, this logic doesn't work:
>cd Y
>bzr log -rX
prints the revision even if X is NOT in the branch, as long as it's somewhere in the shared repository. In our case, X was only in another branch Z in the same repo.
This "lookup in the shared repo":
1) is contradicting "bzr help log" which says:
"Purpose: Show historical log for a branch or subset of a branch."
(says "branch", not "repository")
2) leaves us with no command to determine whether X is in the branch, unless we resort to the full log, like
>bzr log | grep X
which is much slower and error-prone (commit comments may also contain revids, this happens, which could lead to false positives).
How to reproduce the problem: below I create a shared repo and two branches under it.
[T35 10:44 /tmp $]
bzr init-repo repo
Shared repository with trees (format: 2a)
Location:
shared repository: repo
[T35 10:44 /tmp $]
cd repo/
[T35 10:44 /tmp/repo $]
bzr init v1
Created a repository tree (format: 2a)
Using shared repository: /tmp/repo/
[T35 10:45 /tmp/repo $]
cd v1
[T35 10:45 /tmp/repo/v1 $]
touch foo
[T35 10:45 /tmp/repo/v1 $]
bzr add .
adding foo
[T35 10:45 /tmp/repo/v1 $]
bzr commit -m1
Committing to: /tmp/repo/v1/
added foo
Committed revision 1.
[T35 10:45 /tmp/repo/v1 $]
cd ..
[T35 10:45 /tmp/repo $]
bzr branch v1 v2
Branched 1 revision.
[T35 10:45 /tmp/repo $]
cd v2
[T35 10:45 /tmp/repo/v2 $]
touch bar
[T35 10:45 /tmp/repo/v2 $]
bzr add .
adding bar
[T35 10:45 /tmp/repo/v2 $]
bzr commit -m2
Committing to: /tmp/repo/v2/
added bar
Committed revision 2.
# So what we have so far is: v1 ("version 1 of software") having revision 1, and v2 ("version 2") having revision 1 and 2.
[T35 10:45 /tmp/repo/v2 $]
bzr log
-------
revno: 2
revision-id: <email address hidden>
parent: <email address hidden>
committer: Guilhem Bichot <email address hidden>
branch nick: v2
timestamp: Tue 2011-11-22 10:45:26 +0100
message:
2
-------
revno: 1
revision-id: <email address hidden>
committer: Guilhem Bichot <email address hidden>
branch nick: v1
timestamp: Tue 2011-11-22 10:45:09 +0100
message:
1
[T35 10:45 /tmp/repo/v2 $]
cd ../v1
[T35 10:45 /tmp/repo/v1 $]
bzr log
-------
revno: 1
revision-id: <email address hidden>
committer: Guilhem Bichot <email address hidden>
branch nick: v1
timestamp: Tue 2011-11-22 10:45:09 +0100
message:
1
# Now I want to see whether v1 contains revision 2:
[T35 10:45 /tmp/repo/v1 $]
bzr log -r revid:<email address hidden>
-------
revision-id: <email address hidden>
parent: <email address hidden>
committer: Guilhem Bichot <email address hidden>
branch nick: v2
timestamp: Tue 2011-11-22 10:45:26 +0100
message:
2
Whereas v1 does NOT contain this revision, in fact.
Bazaar (bzr) 2.5.0dev3
from bzr checkout /home/mysql_
revision: 6237
revid: <email address hidden>
branch nick: bzr.dev
tags: | added: check-for-breezy |
Continuing with the example above, revision 2 shows up even after no branch has it anymore:
[T35 10:55 /tmp/repo/v2 $]
cd ..
[T35 10:55 /tmp/repo $]
cd v1
[T35 10:55 /tmp/repo/v1 $]
cd ..
[T35 10:55 /tmp/repo $]
rm -rf v2
Are you sure to want to rm these: '/tmp/repo/v2' ? [y/n]y
[T35 10:55 /tmp/repo $]
ls
v1
# So at this moment there is no branch containing this revision.
[T35 10:55 /tmp/repo $] ------- ------- ------- ------- ------- ------- ------- ----
cd v1
[T35 10:55 /tmp/repo/v1 $]
bzr log -r revid:<email address hidden>
-------
revision-id: <email address hidden>
parent: <email address hidden>
committer: Guilhem Bichot <email address hidden>
branch nick: v2
timestamp: Tue 2011-11-22 10:45:26 +0100
message:
2
But it still shows up above.