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.
Who is Participating?
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.

RockingAuthor Commented:
I am new to groovy is there any script exists wid you related with my requirement to share ?
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" />
            <exec executable="svn">
                  <arg line="log -r@{rev}:HEAD @{url}"/>
                  <redirector outputproperty="svnlogs.logs.out">                   
                  <outputmapper type="merge" to="@{outfile}"/>
            <!-- For debugging comment this in
            <echo message="Output: ${svnlogs.logs.out}" />

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) ;


Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.