Sink the dependent repository with the main repository automatically.

Sink the dependent repository with the main repository automatically.
The url for both the repository are different.

Say i have a external repository (client repository )  and i have an internal repository .
Now there are frequent updates on client repository and i need to manually take the documents from that repository and add it in our internal repository so that the external and internal repository are in sink.

I am doing it manually what i need is that i can write an batch program for the above so that when ever the external SVN is updated my internal repository also gets updated.

As of now i am using commit monitor tool to monitor the updates on external svn.
RockingAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dpearsonCommented:
I'm not aware of any automatic tools to do this - but it should be pretty simple to write a script that:

a) Pulls the svn log from the external repository for a specific time range (e.g. yesterday)
b) Goes through each log entry
c) Copies the updated file to the right place and issues an add/commit to the internal repository for the changes from the external repository

Then you just need to run this once per day as a scheduled job and you would be synched up.

The question would be what scripting language to use to do the work.  I'd use groovy myself, since I find it easy to work with (since I know Java), but I'm sure Python would work fine too.  You will find it very hard to write this in just a shell language (like Windows batch command or Linux bash shell) - so use a proper scripting language.

Doug

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RockingAuthor Commented:
I am new to groovy is there any script exists wid you related with my requirement to share ?
dpearsonCommented:
I don't have any code that does what you need, but here are some snippets that may help you get started.

This is how we lookup the svn logs inside another tool (called "ant"):

      <!-- Get the svn logs from a particular revision up to the head -->
      <macrodef name="log-from-rev">
            <attribute name="url" />
            <attribute name="rev" />
            <attribute name="outfile" />
            <sequential>
            <exec executable="svn">
                  <arg line="log -r@{rev}:HEAD @{url}"/>
                  <redirector outputproperty="svnlogs.logs.out">                   
                  <outputmapper type="merge" to="@{outfile}"/>
                  </redirector>
            </exec>
            <!-- For debugging comment this in
            <echo message="Output: ${svnlogs.logs.out}" />
            -->
            </sequential>
      </macrodef>

And then this is some groovy code (again running inside "ant") that examines the logs and writes out the entries that contain a specific marker.

As I say, it's not exactly what you need - but it's a starting point to begin to learn.

				String inputFilename="@{in}";
				String outputFilename="@{out}";
				String targetTag="@{tag}".toLowerCase() ;
				BufferedReader input = new BufferedReader(new FileReader(inputFilename));
				PrintWriter output = new PrintWriter(new BufferedWriter(new FileWriter(outputFilename))) ;

				String br = "\n" ; //"&lt;br&gt;"
				String already = project.getProperty("svnlogs.entries.written") ;
				String logs = project.getProperty("svnlogs.logs") ;
				if (logs == null) logs = "\n\n" ;
				int entriesAlready = (already != null) ? Integer.parseInt(already) : 0 ;
				String line ;
				int entriesWritten = entriesAlready ;
				List section = new ArrayList() ;
				StringBuilder str = new StringBuilder() ;
				str.append(logs) ;
				while ((line = input.readLine()) != null) {
				    if (line.contains("------------")) {
					    boolean printSection = false ;
					    for (String sectionLine : section) {
							if (sectionLine.toLowerCase().contains(targetTag)) {
							   printSection = true ;
							}
						}
						
						if (printSection) {
							entriesWritten++ ;
						    boolean first = true ;
							for (String sectionLine : section) {								
								if (first) {
								    if (sectionLine.indexOf("|") != -1) {
										String who = sectionLine.substring(sectionLine.indexOf("|")+1) ;
										who = who.substring(0, who.lastIndexOf(":")) ;
										sectionLine = who.trim() ;
										output.println() ;
										str.append(br) ;
									}
								}
								first = false ;
								
								if (sectionLine.trim().isEmpty())
								   continue ;
								
								output.println(sectionLine) ;
								str.append(sectionLine + br) ;
							}
						}
						section.clear() ;
					} else {
					   section.add(line) ;
					}	
				}

				input.close();
				output.close();

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Version Control

From novice to tech pro — start learning today.