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

Re: Facing issue in SVN pre commit hook | svnlook cat

From: Branko Čibej <brane_at_wandisco.com>
Date: Thu, 25 Jun 2015 10:16:32 +0200

On 25.06.2015 10:15, Scott Aron Bloom wrote:
>
> If the variable $TXN contains a *, it is getting expanded by the echo
> command, unix is expanding that before the echo is called.
>
>
>
> I would put single around the variable on your echo command
>

A single quote would make the command print:

    contents: $fileContents

which is not what he wants ...

> *From:* Dhiraj Prajapati [mailto:dhiraj.prajapati_at_games24x7.com]
>
> *Sent:* Thursday, June 25, 2015 1:10 AM
> *To:* Branko Čibej
> *Cc:* users_at_subversion.apache.org
> *Subject:* Re: Facing issue in SVN pre commit hook | svnlook cat
>
>
>
> Below is the code snippet I am using. I need the file contents in a
> variable.
>
>
>
> *fileContents=`$SVNLOOK cat $REPOS $FNAME -t $TXN`*
>
> *echo "contents:" $fileContents 1>&2*
>
>
>
> Am I doing anything wrong?
>
>
>
> -Dhiraj
>
>
>
> On Thu, Jun 25, 2015 at 1:37 PM, Branko Čibej <brane_at_wandisco.com
> <mailto:brane_at_wandisco.com>> wrote:
>
> On 25.06.2015 09:31, Dhiraj Prajapati wrote:
>
> Hi,
>
> I have a pre-commit hook which validates the contents of the files
> being committed before commit.
>
> I am using /svnlook cat/ command to read the contents of the file
> being committed.
>
> However, whenever there is a leading slash on a particular line in
> the file, the /svnlook cat/ command fails to display the slash.
> Instead it prints the names of all the files/folders in the root
> directory.
>
>
>
> *Example file contents:*
>
>
>
> xyz
>
> <input name=abc/>
>
> /*
>
> abc
>
>
>
> *Command:*
>
>
>
> svnlook cat <repository_path> <file_name> -t <txn>
>
>
>
> *Output:*
>
>
>
> xyz <input name=abc/> /app /bin /boot /cdrom /dev /etc /home /lib
> /lost+found /media /mnt /opt /proc /root /run /sbin /sources /srv
> /sys /tmp /usr /var /vmlinuz /vmlinuz.old abc
>
>
>
> I want/svnlook cat/ to print exactly what is in the file. Please
> assist.
>
>
>
> This is "impossible" in the sense that 'svnlook cat' does not process
> the contents in any way, it just prints them to stdout.
>
> You're probably piping the output of 'svnlook cat' into some kind of
> program or script that validates them, and I suspect that script is
> interpreting the contents so that it lists the directory contents as
> you described. You should most likely look for the bug in your
> validation script.
>
> -- Brane
>
>
>
Received on 2015-06-25 10:16:51 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.