[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: How to see when an item was added using svnlook?

From: Johan Corveleyn <jcorvel_at_gmail.com>
Date: Tue, 2 Jan 2018 13:46:25 +0100

On Tue, Jan 2, 2018 at 1:42 PM, Johan Corveleyn <jcorvel_at_gmail.com> wrote:
> On Tue, Jan 2, 2018 at 1:29 PM, Bo Berglund <bo.berglund_at_gmail.com> wrote:
>> On Tue, 02 Jan 2018 09:59:15 +0000, Daniel Shahaf
>> <d.s_at_daniel.shahaf.name> wrote:
>>
>>>Branko ?ibej wrote on Tue, 02 Jan 2018 09:42 +0100:
>>>> On 01.01.2018 21:28, Bo Berglund wrote:
>>>> > Is there a command to show the revision when an item (directory or
>>>> > file) was actually created in svn?
>>>>
>>>> Currently the only hack to do this is by using 'svn log --stop-on-copy'
>>>> in a working copy.
>>>
>>>Wouldn't 'svn log --stop-on-copy URL' work?
>>>
>>>There's also this (not immediately obvious) command for showing the
>>>revision that created TARGET at that location, via a copy or otherwise:
>>>
>>> svn log -r 0:HEAD -q -v --stop-on-copy --limit=1 -- TARGET
>>
>> I believe this only works in a working copy, not on the server in a
>> hook...
>
> As Daniel suggested, this also works with a URL as target. You don't
> need a working copy. It's fine to run 'svn' with a URL from within a
> hook:
>
> svn log -r 0:HEAD -q -v --stop-on-copy --limit=1 -- $URL_TO_BRANCH
>
> Some svn admins only try to limit their hooks to svnlook, but at some
> point that falls short of what you need to do ('svn' is often more
> powerful). I see no problem using the 'svn' executable.

Forgot to add: an important difference, of course, is that 'svn' can
only be used to inspect revisions that have already been committed
(like from a post-commit hook, or from tools that run in a cron job
and inspect committed revisions). If you want to inspect an
uncommitted transaction, as you would do in the pre-commit hook, then
you have no alternative, you have to use svnlook.

-- 
Johan
Received on 2018-01-02 13:46:51 CET

This is an archived mail posted to the Subversion Users mailing list.