Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: msdos batch file to build projects using subversion svn tool  (Read 10257 times)

0 Members and 1 Guest are viewing this topic.

helpcindy

    Topic Starter


    Rookie

    hi!
    im a begginner in writting batch files.I would really gratefull if someone could guide me as to how to go about creating a batch file that could be used to merge files present in different directories using the svn subversion tool.
    thanks!

    gpl



      Apprentice
    • Thanked: 27
      Re: msdos batch file to build projects using subversion svn tool
      « Reply #1 on: July 22, 2009, 12:38:24 AM »
      Hi
      The first step is to define clearly what you want to achieve.
      How do you define which versions are to overwrite the master and in which order ?
      Which different directories do you mean ? Are your updates in a tree ? are the directories named in a special way ?

      With all this information, Im sure we could come up with a pretty good tool
      Graham


      helpcindy

        Topic Starter


        Rookie

        Re: msdos batch file to build projects using subversion svn tool
        « Reply #2 on: July 22, 2009, 12:48:49 AM »
        hi !
        thank u so much for the reply!
        il try my best to explain to you what exactly im trying to achieve.
        iv basically got two folders.one belonging to me and the other to the server.so i have to check if there are any new additions to the folder in the server using the subversion tool and update my folder with the new files and folders.so my goal is basically to build a project using an automated script.

        gpl



          Apprentice
        • Thanked: 27
          Re: msdos batch file to build projects using subversion svn tool
          « Reply #3 on: July 22, 2009, 02:04:23 AM »
          Here is a link to the command line operation of subversion http://www.sunsource.net/scdocs/ddUsingSVN_command-line this would be the first thing that you need to understand how to do.

          Do you know how you will cope with changes to files that you have changed ?

          helpcindy

            Topic Starter


            Rookie

            Re: msdos batch file to build projects using subversion svn tool
            « Reply #4 on: July 22, 2009, 03:18:03 AM »
            thank you for the link.
            it seems to have everything that i will need.i am still learning how to write batch files so im guessing it will take some time for me to understand how exactly to go about writing the script.

            in response to your question:by changes what changes are u refering to? i will have to consider the changes made by everyone else and incorporate it into my folder right..

            helpcindy

              Topic Starter


              Rookie

              Re: msdos batch file to build projects using subversion svn tool
              « Reply #5 on: July 22, 2009, 03:19:26 AM »
              oh so in case i make changes in a file i will have to update it in the server right?...is that what u mean?

              gpl



                Apprentice
              • Thanked: 27
                Re: msdos batch file to build projects using subversion svn tool
                « Reply #6 on: July 22, 2009, 03:21:26 AM »
                Im thinking of a situation where you and someone else have made a change to the same file(s), this is quite tricky to manage

                helpcindy

                  Topic Starter


                  Rookie

                  Re: msdos batch file to build projects using subversion svn tool
                  « Reply #7 on: July 22, 2009, 03:27:46 AM »
                  ah..!
                  im guessing that in case of a situation like that a conflict will arise.There are a few options by which you can solve such conflicts.It will have to be done interactively wherein you select whether you consider "mine-full",or "theirs-full",or merge them.This is what the guide said about conflicts.

                  helpcindy

                    Topic Starter


                    Rookie

                    Re: msdos batch file to build projects using subversion svn tool
                    « Reply #8 on: July 22, 2009, 03:30:28 AM »
                    would you by any chance know where i could find a model batch script around which i could work,so that it could help me frame my required script.?

                    gpl



                      Apprentice
                    • Thanked: 27
                      Re: msdos batch file to build projects using subversion svn tool
                      « Reply #9 on: July 22, 2009, 05:00:49 AM »
                      I dont have any sample code Im afraid, to be honest I use tortoise svn to manage most of the time. I understand that there are other free subversion tools that manage to combine several different versions of files quite well

                      If I have a branch of changes, I usually follow the steps below

                      extract the trunk (master copy) to a directory on the file system
                      extract the branch of changes to a different directory on the file system
                      copy the changed files to the trunk (master) directory
                      commit the changes

                      As long as there are no other changes committed to the trunk (master) for updated files, this should all work well. If there have been changes, and you are trying to copy an older version over an updated one, there will be problems.

                      If someone else has committed a change to a file that you are trying to commit, then you have a bit of a headache !!

                      The logic for your process goes something like this :
                      1 - extract the trunk
                      2 - identify the changes in your development branch and extract those to a different folder
                      3 - MOVE all files in the branch that are newer than the same file in the trunk to the trunk directory
                      4 - any files that are left are the problem ones and will need manual intervention to merge the changes -- I suggest your process stops at this point - re-running will pick up your fixes
                      5 - commit the trunk back to the repository

                      I havent looked at the command-line functionality - can you start to sketch out a script from this (and correcting any errors in my logic above) ?

                      helpcindy

                        Topic Starter


                        Rookie

                        Re: msdos batch file to build projects using subversion svn tool
                        « Reply #10 on: July 27, 2009, 04:18:17 AM »
                        yes i think i will be able to frame a code using the steps you have provided.
                        thank you so much for your help.! i will let you know if im successful !
                         :)

                        helpcindy

                          Topic Starter


                          Rookie

                          Re: msdos batch file to build projects using subversion svn tool
                          « Reply #11 on: July 27, 2009, 04:34:46 AM »
                          another query:
                          during the development of the file,i will need a sample repository to carry out my tests and check various functions.how do i go about it?

                          helpcindy

                            Topic Starter


                            Rookie

                            Re: msdos batch file to build projects using subversion svn tool
                            « Reply #12 on: July 27, 2009, 04:52:58 AM »
                            so according to your logic i extract the trunk,which would basically mean downloading my working copy by selecting svn checkout right? then i svn update it to get the changes made by different people on my team.When i update it,i replace the older files with its newer versions in the working copy right?
                            i didn quite follow what you meant by saying i must move all the files into a seperate folder and the ones left after replacing are problem ones.
                            i apologize for the never ending doubts!
                             ;)

                            gpl



                              Apprentice
                            • Thanked: 27
                              Re: msdos batch file to build projects using subversion svn tool
                              « Reply #13 on: July 27, 2009, 07:35:00 AM »
                              I envisage the setup to be as follows

                              There is a master copy of all of the files, the trunk. Then you have your branch, where you do your work, this is isolated from the trunk.

                              When you extract the trunk to a directory, it has all the new changes from other developers (Im assuming you are working in a multi developer environment).

                              You need to identify all of the files in your working copy of the branch that you have changed, ones that havent changed can be ignored.

                              The logic in my earlier post was slightly wrong, you may have changed a file that was changed in the trunk earlier by someone else, so simply overwriting it would lose those changes.

                              So, you need to check out your working copy, merge it in with the trunk (I use the file system to do this instead of repository itself, then commit the changes in the trunk back to the repository).

                              The merge process is the problem, where you are the only person making changes, this is simple. Im not sure how you manage the conflicted updates, as I said before there are subversion clients that handle this better than tortoise. Here, if the changes are to different parts of the code, it is fairly simple to merge together but when the change has been made to the same lines, I can see no simple way to merge them without doing it by hand.

                              Depending on what powers you have, you should be able to create a test repository where you can check out the different scenarios.

                              helpcindy

                                Topic Starter


                                Rookie

                                Re: msdos batch file to build projects using subversion svn tool
                                « Reply #14 on: July 27, 2009, 11:22:14 PM »
                                i actually sat down with my advisor and found out what exactly i am expected to do,i discussed the merging problem.Since i am new to this and i am just taking it up as a small project he suggested for now that i overwrite the files that have been changed.He asked me to carry out the following steps:
                                         1.Manually checkout the working copy and the particular server folder
                                       using a batch file:
                                        2.Update working copy
                                        3.Update server folder
                                        4.Copy and overwrite any files that are different in server folder and working copy by copying them from server copy and replacing them in working copy
                                        5.Start the build
                                        6.Determine whether there is an error or not and display it on the screen