summaryrefslogtreecommitdiffstats
path: root/svnmergedocs.py
blob: 349aacb42b0b7e1cc02eb1e6c79d27f18aa8095b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os, os.path

svnbase = "/home/jim/PyKDE/doc/classref"
newbase = "/home/jim/PyKDE352/doc/classref"

newfiles = os.listdir (newbase)

for file in newfiles:
    if os.path.isdir (file):
        newpath = os.path.join (newbase, file)
        svnpath = os.path.join (svnbase, file)
        if os.path.exists (svnpath):
            newdoc = os.listdir (newpath)
            svndoc = os.listdir (svnpath)
            for doc in newdoc:
                os.system ("cp %s %s" % (os.path.join (newpath, doc), svnpath))
                if doc not in svndoc:
                    os.system ("svn add %s" % (os.path.join (svnpath, doc)))
                    print("added %s" % doc)
        else:
            os.system ("cp -R %s %s" % (newpath, svnpath))
            os.system ("svn add %s" % svnpath)
    else:
        if os.path.exists (os.path.join (svnbase, file)):
            os.system ("cp %s %s" % (os.path.join (newbase, file), svnbase))
        else:            
            os.system ("cp %s %s" % (os.path.join (newbase, file), svnbase))
            os.system ("svn add %s" % (os.path.join (svnbase, file)))