Working with tags in qlog, related to loggrahpviz.py

0 views
Skip to first unread message

André Bachmann

unread,
Feb 10, 2012, 7:00:40 AM2/10/12
to QBzr
When I'm in a qlog window of a repository I usually see all branches
with their history. If I right-click on a revision and select "Tag
revision...", there is a sub menu where I can select which branch I
want to tag. However, this list with the full paths of branches is
truncated. The result is that the user only sees the beginning of the
branch path like "C:\directory\project\12345..." but not the end of it
where usually the branch name is located (e.g. if the complete branch
path is "C:\directory\project\12345xyz\trunk" and "C:\directory\project
\12345xyz\testing").

I have managed to follow this to loggraphviz.py in class BranchInfo -
this is used to create the context menu entry. But my full path is
already truncated in branch.label in this class. What is the reason
behind this?

Alexander Belchenko

unread,
Feb 10, 2012, 7:44:34 AM2/10/12
to qb...@googlegroups.com
André Bachmann пишет:

The reason to truncate was simple: make sure we won't run of screen
space. But the truncation algorithm is not optimal, the better option
would be show the beginnig of the path and then end part of the path, in
my opinion. There was also wishlist to show the full path as hint when
you hover on the label, but I'm not sure whether it's implemented or not.

--
All the dude wanted was his rug back

André Bachmann

unread,
Feb 10, 2012, 8:42:44 AM2/10/12
to QBzr
Thanks for the explanation. I couldn't find the file where this
truncation is really done, because I got stuck at backtracking it in
loggraphviz.py. So where is this truncation really done?

Alexander Belchenko

unread,
Feb 10, 2012, 9:57:24 AM2/10/12
to qb...@googlegroups.com
André Bachmann пишет:

I've grepped for BranchInfo and found in log.py:

lines 267-268:

label = self.branch_label(None, self.branch)
bi = BranchInfo(label, self.tree, self.branch)

And self.branch_label is at line 380 in the same file.

I think that's what you're looking for.

André Bachmann

unread,
Feb 14, 2012, 5:01:42 AM2/14/12
to QBzr
Ok thanks, I found the place where the truncation itself is done (in
method elided_text from log.py). I also played a little bit with
QFontMetrics.elidedText.

What was the reason why the full path to the branch is used for this,
rather than only the name of the branch? I mean, you are in a certain
repository (its path is also shown in the title bar of qlog's window)
- so displaying the path information in front of the branch name is
quite redundant. Or are there any cases where a branch could be
outside of its own repository (so the full path information gets
important)?

Alexander Belchenko

unread,
Feb 14, 2012, 7:07:18 AM2/14/12
to qb...@googlegroups.com
André Bachmann пишет:

> What was the reason why the full path to the branch is used for this,
> rather than only the name of the branch? I mean, you are in a certain
> repository (its path is also shown in the title bar of qlog's window)
> - so displaying the path information in front of the branch name is
> quite redundant. Or are there any cases where a branch could be
> outside of its own repository (so the full path information gets
> important)?

For Windows possible use case is:

bzr qlog C:\path\to\repo\trunk D:\another\path\to\some\repo\trunk

For Linux (imaginable example)

bzr qlog /home/me/project/repo/trunk /tmp/some/trunk

Where is "trunk" and where is "trunk"?

Alexander Belchenko

unread,
Feb 14, 2012, 10:21:42 AM2/14/12
to qb...@googlegroups.com
André Bachmann пишет:
> On 10 Feb., 15:57, Alexander Belchenko <bia...@ukr.net> wrote:
>> André Bachmann пишет:
>>> On 10 Feb., 13:44, Alexander Belchenko <bia...@ukr.net> wrote:
>>
>> And self.branch_label is at line 380 in the same file.
>>
>> I think that's what you're looking for.
>
> Ok thanks, I found the place where the truncation itself is done (in
> method elided_text from log.py). I also played a little bit with
> QFontMetrics.elidedText.
>
> What was the reason why the full path to the branch is used for this,
> rather than only the name of the branch? I mean, you are in a certain
> repository (its path is also shown in the title bar of qlog's window)
> - so displaying the path information in front of the branch name is
> quite redundant. Or are there any cases where a branch could be
> outside of its own repository (so the full path information gets
> important)?

I think the right way to fix that (honestly: annoying) behavior is to
have all branch paths upfront available to collect some statistics about
the set, and choose the best strategy for different use cases.

1) For simple use case: all paths has the same prefix (under the same
repo or inside main working directory in subfolders): strip the common
prefix and show only unique part of the path. That way we will have
either basename for all branches, or basename plus unique prefix related
to subdirectory, e.g. "trunk", "work", "bugfix", and maybe "original/trunk".

2) If some of the branches are from remote location, bzr+ssh, lp, or
something different, we may need to save the URL as much as we can.

3) If we have branches without common prefix (from different drives, or
from different directories from /) then the best we can do is elide the
full path in the middle, effectively showing the beginning of unique
prefix and the trailing part.

That could be quite involved to fix it in log.py, along the lines
303-304 in log.py. I think we'll need to change API of BranchInfo and
found the way to put the label after we have processed all branches and
collected information about their common prefixes. Maybe we just have to
convert label attribute to property of BranchInfo and make sure we can
compute it later.

Reply all
Reply to author
Forward
0 new messages