bzr cat without argument should use the latest revision

Bug #3632 reported by Matthieu Moy
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Unassigned

Bug Description

bzr cat foo.c

should be equivalent to

bzr cat foo.c -r $(bzr revno)

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

How do you specific "bzr cat -r <working tree>" then?

I think the default is fine, since that is the same idea behind quite a few commands.
And you can always specify:

bzr cat -r -1 foo.c

"-1" will always point to the last revision.

(I think you can also do bzr cat -r last:1 foo.c)

Revision history for this message
Matthieu Moy (matthieu-moy) wrote :

> How do you specific "bzr cat -r <working tree>" then?

I don't understand the relationship between my proposal and your question. Currently, I have:

$ bzr cat foo.c
bzr: ERROR: bzr cat requires a revision number

I suggest replacing a forbidden command by a reasonable behavior, that doesn't remove any other behavior.

So, to rephrase my proposal: If "-r" is provided, keep the current behavior. If "-r" is not provided, use the latest revision in the current working tree instead of raising an error. This is what "diff" and "status" do AFAIK.

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

Okay.
I guess I didn't check what "bzr cat" did. I thought "bzr cat" without a revision would cat the current working tree version.

I would prefer that form myself, rather than cat'ing the last committed revision.

diff and status are a comparison, meaning what is the difference between X & Y, so naturally, Y defaults to the working tree, and X defaults to the last committed revision.

Since cat only requires a single entry, I would have that default to the working tree.

Revision history for this message
Matthieu Moy (matthieu-moy) wrote :

That could make sense, but you don't need a revision control tool to access the content of a local file, so I'd rather see the last commited version (which you relatively often want to access too) than the local copy.

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

Except I think "cat" is in the unix-like commands, which do work on the current tree, unless otherwise told.

For instance, you have "bzr mv", and "bzr ls" (though bzr ls is broken in the current version, and probably will have --recursive set by default).

It doesn't make sense to "bzr mv" an older version, true.
But it makes a lot of sense to have "bzr ls" work on the current tree. Since it has a lot of other options (potentially) available.

I don't find myself "relatively often" needing to get the last revision of a file. But that is my workflow, not yours.
You might be doing custom diffing, or somesuch, where I could see wanting the last revision to be a common occurance.
But "-r -1" isn't a whole lot to type either.

John A Meinel (jameinel)
Changed in bzr:
status: New → PendingUpload
Changed in bzr:
status: PendingUpload → Fixed
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.