aboutsummaryrefslogtreecommitdiffstats
path: root/RepSys/rpmutil.py
diff options
context:
space:
mode:
authorBogdano Arendartchuk <bogdano@mandriva.org>2007-05-02 19:41:47 +0000
committerBogdano Arendartchuk <bogdano@mandriva.org>2007-05-02 19:41:47 +0000
commit2e0c7def5895fea29177718abb690b75bc21695e (patch)
treeb07f8b5bb67d29037656ed7a2341b202dfcfb0a3 /RepSys/rpmutil.py
parenta0db56024d803cbe112ce31d8de2aa2701a5d79c (diff)
downloadmgarepo-2e0c7def5895fea29177718abb690b75bc21695e.tar
mgarepo-2e0c7def5895fea29177718abb690b75bc21695e.tar.gz
mgarepo-2e0c7def5895fea29177718abb690b75bc21695e.tar.bz2
mgarepo-2e0c7def5895fea29177718abb690b75bc21695e.tar.xz
mgarepo-2e0c7def5895fea29177718abb690b75bc21695e.zip
Added initial support to mirrors, as requested by mrl.
It was added an option "mirror" to repsys.conf, that will contain an URL to the mirror repository. Also added the subcommand "ci", which will relocate one working copy to the master repository before effectively commiting.
Diffstat (limited to 'RepSys/rpmutil.py')
-rw-r--r--RepSys/rpmutil.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/RepSys/rpmutil.py b/RepSys/rpmutil.py
index 367fd45..12a8226 100644
--- a/RepSys/rpmutil.py
+++ b/RepSys/rpmutil.py
@@ -1,5 +1,6 @@
#!/usr/bin/python
from RepSys import Error, config, RepSysTree
+from RepSys import mirror
from RepSys.svn import SVN
from RepSys.rpm import SRPM
from RepSys.log import specfile_svn2rpm
@@ -357,8 +358,31 @@ def checkout(pkgdirurl, path=None, revision=None):
current = os.path.join(pkgdirurl, "current")
if path is None:
_, path = os.path.split(pkgdirurl)
+ if mirror.enabled():
+ current = mirror.checkout_url(current)
+ print "checking out from mirror", current
svn.checkout(current, path, rev=revision, show=1)
+def commit(target=".", message=None):
+ svn = SVN(noauth=True)
+ info = svn.info2(target)
+ url = info.get("URL")
+ if url is None:
+ raise Error, "working copy URL not provided by svn info"
+ if mirror.enabled():
+ newurl = mirror.switchto_parent(svn, url, target)
+ print "relocated to", newurl
+ try:
+ # we can't use the svn object here because pexpect hides VISUAL
+ mopt = ""
+ if message is not None:
+ mopt = "-m \"%s\"" % message
+ os.system("svn ci %s %s" % (mopt, target))
+ finally:
+ if mirror.enabled():
+ mirror.switchto_mirror(svn, newurl, target)
+ print "relocated back to", url
+
def get_submit_info(path):
path = os.path.abspath(path)