On Tue, Nov 29, 2011 at 7:44 AM, Daniel Shahaf <d...@daniel.shahaf.name> wrote:
> Jerryleen S wrote on Tue, Nov 29, 2011 at 10:50:06 +0530:
>> but as per discussion in the thread it isn't possible to differentiate
>> deleting or adding or modifying transaction during pre-commit script.
>>
>
> I don't understand what you're claiming.  The situation is:
>
> - The pre-commit hook knows the EXACT contents of the transaction
>  (which will become a revision if the hook does exit(0)).  That in
>  particular includes the equivalent of 'svn log -qv' of the txn.
>
>  (five minutes on a file:///tmp/r repository with 'svnlook -t' will
>  confirm or refute this)
>
> - The pre-commit hook can modify the txn before it becomes a revision.
>  Such modifications cannot be communicated to the client performing the
>  commit.
>
>  (for the former assertion, see svn_fs_open_txn() and similar FS APIs.
>  for the latter, the client code (libsvn_ra and libsvn_wc) assumes that
>  the changes sent to the server are those committed, and updates the wc
>  state based on the changes sent.)

To reiterate what Daniel said: you can perfectly well see the
difference between an Add (A), a Delete (D) or a Modification (M) in a
pre-commit hook. The command 'svnlook changed -t <transaction>' will
give you a list of everything that's about to be changed by the
transaction in question. Lines beginning with A indicate Additions, D
for Deletes and M for Modifications.

Of course this is only speaking at file/directory granularity (which
files/directories are added, deleted, modified). If you want to know
if a Modified file has additions, deletions or modifications, you'll
have to examine/parse the output of 'svnlook diff' to see the concrete
content changes ...

-- 
Johan

Reply via email to