Announcement

Collapse
No announcement yet.

pre-commit hook

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • pre-commit hook

    Hi i want to list files in particular folder and want to store result in variables. i am using perl. Can you any one help?

    if i run this in command prompt --> svn.exe list svn://10.0.1.58/javra/myfolder/ ----- it works fine. it shows the all the files inside the folder "myfolder" from repository.

    Now i want to implement this concept in pre-commit hook.

    pre.commit.pl
    -----------------
    $logfile = "C:\\svn_repository\\javra\\hooks\\svn_pre_commit_ log.txt";
    $svn = '"C:\Program Files\CollabNet Subversion Server\svn.exe"';
    my $svn_list = `$svn list svn://10.0.1.58/javra/myfolder`;

    open FILE, " >> $logfile";
    print FILE $svn_list;
    close FILE;

    -------------------------------------------------------------------

    but when i commit any files , it's getting stuck. i am struggling for this. plz send the solution in "nandeshwar.sah@gmail.com" . thanks in advance.

  • #2
    Why did you escape the backslashes for $logfile but not $svn?

    What happens if you run the script manually?

    Does the user account svnserve runs under have execute permission on the script, and write permission on $logfile?

    There are Perl language bindings for Subversion so that you don't have to call svn.exe and parse the output. Those will ultimately be more flexible & easier to manage.

    Comment


    • #3
      pre-commit hook

      Hi Andy,
      thanks for your quick reply. The script runs successfully when i run manually.

      problem comes when i commit file and call the pre-commit hook.pl. ....getting stuck...

      please analyze the following code first one works fine. but wt happened to next one....
      ---------------------------
      $svnlook = '"C:\Program Files\CollabNet Subversion Server\svnlook.exe"';
      $logfile = "C:\\svn_repository\\javra\\hooks\\svn_pre_commit_ log.txt";

      $rev = trim(`$svnlook youngest $repos`);
      my $changed = `$svnlook changed $repos -t $txn`;

      open FILE, " >> $logfile";
      print FILE $changed;
      close FILE;
      -----------------------------------------------------

      but the code given below does not work.

      ----------------------
      $svn = '"C:\\Program Files\\CollabNet Subversion Server\\svn.exe"';
      $logfile = "C:\\svn_repository\\javra\\hooks\\svn_pre_commit_ log.txt";

      my $svn_list = `$svn list --verbose svn://10.0.1.58/javra/install`;

      open FILE, " >> $logfile";
      print FILE $svn_list;
      close FILE;

      -----------------------------------------------

      the first one using "svnlook.exe" works fine
      the 2nd one using "svn.exe " does not..while committing file but works indepently......


      thks..

      Comment


      • #4
        Does the repository require authentication to perform a list?

        Comment


        • #5
          As Andy pointed it seems like authentication issue....

          Comment


          • #6
            svn pre-commit

            thanks for your reply. but problem still remains same. I want to list all the filenames in pre-commit hook. but how? still trying ......

            Comment


            • #7
              You were asked a question which may help us resolve your issue. You have not answered it. How do you expect to receive help if you keep saying "it's still broken, it's still broken" but don't bother to give any information to the people trying to help you?

              Comment


              • #8
                svn pre-commit

                hey Andy, I don't need to give any password or user id while committing file.

                Comment


                • #9
                  What is in case of Tortoise SVN:--

                  svn.exe" is not present there:--




                  $svn = '"C:\\Program Files\\CollabNet Subversion Server\\svn.exe"';

                  Comment


                  • #10
                    Originally posted by wasi_shez
                    What is in case of Tortoise SVN:--

                    svn.exe" is not present there:--




                    $svn = '"C:\\Program Files\\CollabNet Subversion Server\\svn.exe"';
                    TortoiseSVN is not CollabNet Subversion Server. If you don't have the CollabNet Server distribution installed, that won't work. TSVN does not include the command-line client/tools.

                    Comment


                    • #11
                      svn is a client side command which only work in a sandbox. you should always use svnlook from server side.

                      Comment


                      • #12
                        Originally posted by shawn2001
                        svn is a client side command which only work in a sandbox.
                        "Sandbox" is not a defined term in the Subversion world.

                        Comment


                        • #13
                          Originally posted by andyl
                          Originally posted by shawn2001
                          svn is a client side command which only work in a sandbox.
                          "Sandbox" is not a defined term in the Subversion world.
                          yes, you are right. let's say "Working Copy"

                          Comment

                          Working...
                          X