Jason Sachs wrote on Tue, Feb 22, 2011 at 11:36:45 -0500:
> Hmm, a merge attempt isn't that hard, here's another script that does
> that, and has the same problem.
> 
> We don't use local file repositories, but this has the same symptom as
> w/ a remote server.
> 
> hope it's either an easy fix or an easy workaround...
> 
> --Jason

> import subprocess
> import os
> 

Could you use "#!/usr/bin/env python" as the first line please?

Also, the script should rm -rf repos working w_foo w_bar, to make it
re-runnable.

> def getDirAsURL():
>       return "file:///"+(os.getcwd().replace('\\','/'))
> 
> def writeFile(filename,s):
>       with open(filename,"w") as f:
>               f.write(s)
>       
> def shellexec(a):
>       print(str(a))
>       subprocess.call(a)
>       
> def svnadd(path):
>       shellexec(["svn","add",path])
>       
> def svncommit(path,username,msg):
>       shellexec(["svn","commit",path,"--username",username,"-m",msg])
>       
> def svnpropset(path,propname,propval):
>       shellexec(["svn","propset",propname,propval,path])
>       
> def svnupdate(path):
>       shellexec(["svn","update",path])
>       
> def svnversion(path):
>       shellexec(["svnversion",path])
>       
> def svncopy(src,dest,username,msg):
>       
> shellexec(["svn","copy",src,dest,"--username",username,"-m",msg,"--parents"])
>       
> def svncheckout(src,dest):
>       shellexec(["svn","co",src,dest]);
> 
> def svnmkdir(path):
>       shellexec(["svn","mkdir",path,"--parents"])
>       
> def svnmerge_r(src,dest):
>       shellexec(["svn","merge","--reintegrate", src, dest])
>       
> user = "daemon"
> shellexec(["svnadmin","create","repos"])
> svncheckout(getDirAsURL()+"/repos","working")
> svnmkdir("working/foo/trunk/")
> svnmkdir("working/bar/trunk/")
> svncommit("working",user,"init checkin")
> 
> svncheckout(getDirAsURL()+"/repos/foo/trunk","w_foo")
> writeFile("w_foo/blah.txt","this is blah.txt, first version")
> svnadd("w_foo/blah.txt")
> svncommit("w_foo",user,"init checkin")
> writeFile("w_foo/blah.txt","this is blah.txt, second version")
> svncommit("w_foo",user,"next checkin")
> 
> svncheckout(getDirAsURL()+"/repos/bar/trunk","w_bar")
> writeFile("w_bar/hohum.txt","hohum.txt")
> svnadd("w_bar/hohum.txt")
> svncommit("w_bar",user,"another checkin")
> svncopy("w_bar",getDirAsURL()+"/repos/bar/branches/br1",user,"making a 
> branch")
> 
> writeFile("w_foo/blah.txt","this is blah.txt, third version")
> svncommit("w_foo",user,"next checkin")
> 
> svnupdate("w_bar")
> svnpropset("w_bar","svn:externals"," blah.txt -r 3 ^/foo/trunk/blah.txt")
> svncommit("w_bar",user,"add externals")
> 
> svnupdate("w_bar")
> svnversion("w_bar")
> svnmerge_r(getDirAsURL()+"/repos/bar/branches/br1","w_bar")


When I run this, the output ends with

[[[
Committed revision 7.
['svn', 'update', 'w_bar']
svn: Unrecognized format for the relative external URL 'blah.txt'.
['svnversion', 'w_bar']
7
['svn', 'merge', '--reintegrate', 'file:////tmp/svn/repos/bar/branches/br1', 
'w_bar']
--- Merging differences between repository URLs into 'w_bar':
A    w_bar/hohum.txt
]]]

Reply via email to