Michael Sperber wrote:
>>>>>>"Ben" == Ben Collins-Sussman <firstname.lastname@example.org> writes:
> Ben> On Oct 29, 2004, at 4:26 AM, Michael Sperber wrote:
>>>What about if the file has been deleted and I want to to know the last
>>>revision in which it still existed? (Or the rev of the delete, for
> Ben> Run 'svn log -v' on the parent directory (or any of its parent
> Ben> directories), and grep for the delete action.
> Except the delete action might just show some parent directory only.
Yes. This is a very interesting and difficult question. I don't think we have
a good answer at the moment. There are some things we could do in the software
to improve the situation.
It is actually an ambiguous question, with two interpretations. Do you want to
(a) The last revision in which a file (any file) existed at (or was deleted
from) the specified path?
We have no efficient way of answering this question. The best I can think
of would be to search the output of "svn log -v" of the whole repository for
deletion (or move or replacement) of the given path or any parent of it.
To generalise this question, it is also necessary to be able to ask when the
path last existed prior to a given revision. (You could do this by searching
the output of "svn log -v -rREV:1".)
(b) The last revision in which the particular specified file existed?
For this question, first you have to specify the file rather than just its
pathname. You can do this (for some commands) with the "peg revision" syntax:
"path/to/file@REV", meaning the file that existed at the given path in the
given revision. Note that the file might have been copied or moved from a
different path before REV, and might have been copied or moved to a different
path after REV. Note that "REV" is necessarily a revision in which the file
existed before it was deleted, otherwise you are asking question (a).
Then you have to search forward in history, following moves and copies,
until the file is deleted or replaced. Note that the answer to this question
is a list of "path@REV" answers, depending on how many times the file was copied.
I think this task could be performed by a script using "svn log" in a
forward direction: "svn log -v -rREV:HEAD".
Each of these questions can be answered, inefficiently, by a script using "svn
log" on the root of the repository. If someone writes such a script, it would
be nice to distribute it as a contributed tool, at least while we don't have a
Question (a): I am not sure whether we would want to make a proper software
interface for asking this question.
Question (b): I think we should implement peg revisions and forward searching
in commands like "svn log" so that this question is handled. The details need
to be determined - e.g. whether and how it would follow all copies. As an
implementation detail, tracing files forward is inefficient in the current
software architecture, but I think some work may already have been done, or at
least suggested, to improve that.
To unsubscribe, e-mail: email@example.com
For additional commands, e-mail: firstname.lastname@example.org
Received on Tue Nov 2 14:30:03 2004